From patchwork Wed Jun 21 07:55:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeuk Kim X-Patchwork-Id: 13286808 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54859EB64D7 for ; Wed, 21 Jun 2023 07:56:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBsh2-0003vH-Tl; Wed, 21 Jun 2023 03:55:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBsgv-0003qq-3M for qemu-devel@nongnu.org; Wed, 21 Jun 2023 03:55:51 -0400 Received: from mailout3.samsung.com ([203.254.224.33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBsgr-0001ve-TZ for qemu-devel@nongnu.org; Wed, 21 Jun 2023 03:55:48 -0400 Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230621075537epoutp035fa1d8d34de49e397a03e7c8621b64d7~qnXVLIn-c1717317173epoutp03Q for ; Wed, 21 Jun 2023 07:55:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230621075537epoutp035fa1d8d34de49e397a03e7c8621b64d7~qnXVLIn-c1717317173epoutp03Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1687334137; bh=J3MrmB9oYgiljPuXDcj1qliF1LUgLDwZNUzeLUe2imw=; h=Subject:Reply-To:From:To:CC:Date:References:From; b=Mp7hZna5cPZk1nG3Bm+HC1wkdbEpYi5xI5K/eUS6MG/im5fb7aD+dUluBzUuuU15K t/31j5pU/NcRspVLF40JQjze6Da5KvxskN/H86GmmoEWbxwKu+KK/pzZqDoeI73UeW G3eoF1iilqEWBd+q1skpM45JWk83AS8bzXP2sePo= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20230621075537epcas2p2bda01a01438e4e281501c3e2615a5eb6~qnXU2-r211899418994epcas2p2h; Wed, 21 Jun 2023 07:55:37 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.69]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4QmG5N1mCHz4x9Px; Wed, 21 Jun 2023 07:55:36 +0000 (GMT) X-AuditID: b6c32a48-87fff70000007e89-44-6492acf8272b Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id C1.43.32393.8FCA2946; Wed, 21 Jun 2023 16:55:36 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v3 0/3] hw/ufs: Add Universal Flash Storage (UFS) support From: Jeuk Kim To: "qemu-devel@nongnu.org" CC: "kwolf@redhat.com" , "hreitz@redhat.com" , "pbonzini@redhat.com" , "fam@euphon.net" , "qemu-block@nongnu.org" , Klaus Birkelund Jensen , "stefanha@redhat.com" , Jeuk Kim X-Priority: 3 X-Content-Kind-Code: NORMAL X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20230621075535epcms2p7fc17717fe677ab8a8b714607486b7b6a@epcms2p7> Date: Wed, 21 Jun 2023 16:55:35 +0900 X-CMS-MailID: 20230621075535epcms2p7fc17717fe677ab8a8b714607486b7b6a X-Sendblock-Type: AUTO_C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tqV7Sifscevbblr7vLle9PG5snu1n1neBdM1v3 4tPlOW/z3kYzqz88VTfl9YlMqeVV90Ku2jJti5vLv9VrsrZQyjmLlzJLc2wbvVMaBZWaWrSe 2p829z40u6isX+H39uLITc8TdcwSNOaFMjeWV57OW8NkG2hoqbVA0ofJa9bf8ym7A5nUZvMu imFjrt90TMFVV2X9fyWW4oxEQy3mouJEAJFKhP8bBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230621075535epcms2p7fc17717fe677ab8a8b714607486b7b6a References: Received-SPF: pass client-ip=203.254.224.33; envelope-from=jeuk20.kim@samsung.com; helo=mailout3.samsung.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: jeuk20.kim@samsung.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Since v2: Addressed review comment from Stefan Hajnoczi. The main fixes are as follows. - Use of SPDX licence identifiers - fixed endianness error - removed memory leak - fixed DMA error handling logic This patch series adds support for a new PCI-based UFS device. The UFS pci device id (PCI_DEVICE_ID_REDHAT_UFS) is not registered in the Linux kernel yet, so it does not work right away, but I confirmed that it works with Linux when the UFS pci device id is registered. I have also verified that it works with Windows 10. Jeuk Kim (3): hw/ufs: Initial commit for emulated Universal-Flash-Storage hw/ufs: Support for Query Transfer Requests hw/ufs: Support for UFS logical unit MAINTAINERS | 6 + docs/specs/pci-ids.rst | 2 + hw/Kconfig | 1 + hw/meson.build | 1 + hw/ufs/Kconfig | 4 + hw/ufs/lu.c | 1441 +++++++++++++++++++++++++++++++++++ hw/ufs/meson.build | 1 + hw/ufs/trace-events | 59 ++ hw/ufs/trace.h | 1 + hw/ufs/ufs.c | 1545 ++++++++++++++++++++++++++++++++++++++ hw/ufs/ufs.h | 131 ++++ include/block/ufs.h | 1048 ++++++++++++++++++++++++++ include/hw/pci/pci.h | 1 + include/hw/pci/pci_ids.h | 1 + include/scsi/constants.h | 1 + meson.build | 1 + 16 files changed, 4244 insertions(+) create mode 100644 hw/ufs/Kconfig create mode 100644 hw/ufs/lu.c create mode 100644 hw/ufs/meson.build create mode 100644 hw/ufs/trace-events create mode 100644 hw/ufs/trace.h create mode 100644 hw/ufs/ufs.c create mode 100644 hw/ufs/ufs.h create mode 100644 include/block/ufs.h