diff mbox series

[v2] scsi: ufs: ufs-pci: Add support for QEMU

Message ID 20230807013726epcms2p1c604cb8e98680aebebb7cc5ab2d580f5@epcms2p1
State New
Headers show
Series [v2] scsi: ufs: ufs-pci: Add support for QEMU | expand

Commit Message

Jeuk Kim Aug. 7, 2023, 1:37 a.m. UTC
To ensure that the pci based QEMU ufs device properly works with linux,
register the device id (0x0013) and vendor id (0x1b36) of QEMU ufs device.

QEMU UFS will enable testing of the UFS driver inside a virtual machine
on systems without UFS host controller. It can also be used to preemptively
implement and test new features before the real device is created.

The new qemu ufs device can be found at
https://lore.kernel.org/qemu-devel/20230727155239.GA979354@fedora

Signed-off-by: Jeuk Kim <jeuk20.kim@samsung.com>
---

Since v1:
- Based on Adrian's comment, I modified the commit message to be
  more detailed.

---
 drivers/ufs/host/ufshcd-pci.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Adrian Hunter Aug. 7, 2023, 6:01 a.m. UTC | #1
On 7/08/23 04:37, Jeuk Kim wrote:
> To ensure that the pci based QEMU ufs device properly works with linux,
> register the device id (0x0013) and vendor id (0x1b36) of QEMU ufs device.
> 
> QEMU UFS will enable testing of the UFS driver inside a virtual machine
> on systems without UFS host controller. It can also be used to preemptively
> implement and test new features before the real device is created.
> 
> The new qemu ufs device can be found at
> https://lore.kernel.org/qemu-devel/20230727155239.GA979354@fedora
> 
> Signed-off-by: Jeuk Kim <jeuk20.kim@samsung.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

Thank you!

> ---
> 
> Since v1:
> - Based on Adrian's comment, I modified the commit message to be
>   more detailed.
> 
> ---
>  drivers/ufs/host/ufshcd-pci.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/ufs/host/ufshcd-pci.c b/drivers/ufs/host/ufshcd-pci.c
> index cf3987773051..29d322931427 100644
> --- a/drivers/ufs/host/ufshcd-pci.c
> +++ b/drivers/ufs/host/ufshcd-pci.c
> @@ -590,6 +590,7 @@ static const struct dev_pm_ops ufshcd_pci_pm_ops = {
>  };
>  
>  static const struct pci_device_id ufshcd_pci_tbl[] = {
> +	{ PCI_VENDOR_ID_REDHAT, 0x0013, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
>  	{ PCI_VENDOR_ID_SAMSUNG, 0xC00C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
>  	{ PCI_VDEVICE(INTEL, 0x9DFA), (kernel_ulong_t)&ufs_intel_cnl_hba_vops },
>  	{ PCI_VDEVICE(INTEL, 0x4B41), (kernel_ulong_t)&ufs_intel_ehl_hba_vops },
Bart Van Assche Aug. 7, 2023, 9:04 p.m. UTC | #2
On 8/6/23 18:37, Jeuk Kim wrote:
>   static const struct pci_device_id ufshcd_pci_tbl[] = {
> +	{ PCI_VENDOR_ID_REDHAT, 0x0013, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
>   	{ PCI_VENDOR_ID_SAMSUNG, 0xC00C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },

Does Red Hat agree with using device ID 0x0013 for this purpose? Is it 
guaranteed that this device ID won't be used for any other purpose?

Thanks,

Bart.
Jeuk Kim Aug. 8, 2023, 1:01 a.m. UTC | #3
On 8/8/23, Bart Van Assche wrote:
> On 8/6/23 18:37, Jeuk Kim wrote:
>>   static const struct pci_device_id ufshcd_pci_tbl[] = {
>> +	{ PCI_VENDOR_ID_REDHAT, 0x0013, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
>>   	{ PCI_VENDOR_ID_SAMSUNG, 0xC00C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
> 
> Does Red Hat agree with using device ID 0x0013 for this purpose? Is it 
> guaranteed that this device ID won't be used for any other purpose?
> 
> Thanks,
> 
> Bart.

Yes. 
Red Hat donated part of its device ID range to QEMU, which is 1b36:0001 to 1b36:00ff,
and the QEMU community has accepted UFS to use device ID 1b36:0x0013.

The document can be found at https://www.qemu.org/docs/master/specs/pci-ids.html.
As qemu.git/master is frozen for the next release, you cannot see the QEMU UFS device ID on the page now.
You will be able to see it after about 22 August.

Thanks,
Jeuk
Martin K. Petersen Aug. 8, 2023, 2:39 a.m. UTC | #4
Jeuk,

> To ensure that the pci based QEMU ufs device properly works with
> linux, register the device id (0x0013) and vendor id (0x1b36) of QEMU
> ufs device.

Applied to 6.6/scsi-staging, thanks!
Martin K. Petersen Aug. 21, 2023, 10:27 p.m. UTC | #5
On Mon, 07 Aug 2023 10:37:26 +0900, Jeuk Kim wrote:

> To ensure that the pci based QEMU ufs device properly works with linux,
> register the device id (0x0013) and vendor id (0x1b36) of QEMU ufs device.
> 
> QEMU UFS will enable testing of the UFS driver inside a virtual machine
> on systems without UFS host controller. It can also be used to preemptively
> implement and test new features before the real device is created.
> 
> [...]

Applied to 6.6/scsi-queue, thanks!

[1/1] scsi: ufs: ufs-pci: Add support for QEMU
      https://git.kernel.org/mkp/scsi/c/a18e81d17a7e
diff mbox series

Patch

diff --git a/drivers/ufs/host/ufshcd-pci.c b/drivers/ufs/host/ufshcd-pci.c
index cf3987773051..29d322931427 100644
--- a/drivers/ufs/host/ufshcd-pci.c
+++ b/drivers/ufs/host/ufshcd-pci.c
@@ -590,6 +590,7 @@  static const struct dev_pm_ops ufshcd_pci_pm_ops = {
 };
 
 static const struct pci_device_id ufshcd_pci_tbl[] = {
+	{ PCI_VENDOR_ID_REDHAT, 0x0013, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
 	{ PCI_VENDOR_ID_SAMSUNG, 0xC00C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
 	{ PCI_VDEVICE(INTEL, 0x9DFA), (kernel_ulong_t)&ufs_intel_cnl_hba_vops },
 	{ PCI_VDEVICE(INTEL, 0x4B41), (kernel_ulong_t)&ufs_intel_ehl_hba_vops },