All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Cédric Le Goater" <clg@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PATCH v3 08/26] hw/usb: mark commonly used USB devices/hosts as secure
Date: Fri, 13 Nov 2026 18:42:36 +0000	[thread overview]
Message-ID: <20261113184254.2524253-9-berrange@redhat.com> (raw)
In-Reply-To: <20261113184254.2524253-1-berrange@redhat.com>

Modern virtualized guests are expected to be deployed with the
XHCI controller which supports all of USB 1, 2 and 3, so should
be declared secure.

The "NEC" XHCI variant is slightly non-standard, but since it is
a trivial sub-class of the generic XHCI, there's no reason to
exclude it.

The set of devices that are expected to be used is HID (mouse,
tablet, keyboard), host passthrough, CCID (smartcard), hub,
storage and the redirect tunnelling.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 hw/usb/ccid-card-emulated.c   | 1 +
 hw/usb/ccid-card-passthru.c   | 1 +
 hw/usb/dev-hid.c              | 3 +++
 hw/usb/dev-hub.c              | 1 +
 hw/usb/dev-smartcard-reader.c | 2 ++
 hw/usb/dev-storage-bot.c      | 1 +
 hw/usb/dev-storage-classic.c  | 1 +
 hw/usb/hcd-xhci-nec.c         | 1 +
 hw/usb/hcd-xhci-pci.c         | 1 +
 hw/usb/hcd-xhci-sysbus.c      | 3 ++-
 hw/usb/hcd-xhci.c             | 1 +
 hw/usb/host-libusb.c          | 1 +
 hw/usb/redirect.c             | 1 +
 13 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c
index 6c8eec39faa..4083cf8f4be 100644
--- a/hw/usb/ccid-card-emulated.c
+++ b/hw/usb/ccid-card-emulated.c
@@ -612,6 +612,7 @@ static const TypeInfo emulated_card_info = {
     .parent        = TYPE_CCID_CARD,
     .instance_size = sizeof(EmulatedState),
     .class_init    = emulated_class_initfn,
+    .secure        = true,
 };
 module_obj(TYPE_EMULATED_CCID);
 module_kconfig(USB);
diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
index 3f4052ec82e..b951a544ef7 100644
--- a/hw/usb/ccid-card-passthru.c
+++ b/hw/usb/ccid-card-passthru.c
@@ -413,6 +413,7 @@ static const TypeInfo passthru_card_info = {
     .parent        = TYPE_CCID_CARD,
     .instance_size = sizeof(PassthruState),
     .class_init    = passthru_class_initfn,
+    .secure        = true,
 };
 module_obj(TYPE_CCID_PASSTHRU);
 module_kconfig(USB);
diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c
index ae19d60203f..f363449f53e 100644
--- a/hw/usb/dev-hid.c
+++ b/hw/usb/dev-hid.c
@@ -815,6 +815,7 @@ static const TypeInfo usb_tablet_info = {
     .name          = "usb-tablet",
     .parent        = TYPE_USB_HID,
     .class_init    = usb_tablet_class_initfn,
+    .secure        = true,
 };
 
 static const Property usb_mouse_properties[] = {
@@ -837,6 +838,7 @@ static const TypeInfo usb_mouse_info = {
     .name          = "usb-mouse",
     .parent        = TYPE_USB_HID,
     .class_init    = usb_mouse_class_initfn,
+    .secure        = true,
 };
 
 static const Property usb_keyboard_properties[] = {
@@ -860,6 +862,7 @@ static const TypeInfo usb_keyboard_info = {
     .name          = "usb-kbd",
     .parent        = TYPE_USB_HID,
     .class_init    = usb_keyboard_class_initfn,
+    .secure        = true,
 };
 
 static void usb_hid_register_types(void)
diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c
index b45d571fa83..7017b4fbc75 100644
--- a/hw/usb/dev-hub.c
+++ b/hw/usb/dev-hub.c
@@ -694,6 +694,7 @@ static const TypeInfo hub_info = {
     .parent        = TYPE_USB_DEVICE,
     .instance_size = sizeof(USBHubState),
     .class_init    = usb_hub_class_initfn,
+    .secure        = true,
 };
 
 static void usb_hub_register_types(void)
diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c
index 752571043ee..d6d684c27c4 100644
--- a/hw/usb/dev-smartcard-reader.c
+++ b/hw/usb/dev-smartcard-reader.c
@@ -1405,6 +1405,7 @@ static const TypeInfo ccid_bus_info = {
     .name = TYPE_CCID_BUS,
     .parent = TYPE_BUS,
     .instance_size = sizeof(CCIDBus),
+    .secure = true,
 };
 
 void ccid_card_send_apdu_to_guest(CCIDCardState *card,
@@ -1779,6 +1780,7 @@ static const TypeInfo ccid_info = {
     .parent        = TYPE_USB_DEVICE,
     .instance_size = sizeof(USBCCIDState),
     .class_init    = ccid_class_initfn,
+    .secure        = true,
     .interfaces = (const InterfaceInfo[]) {
         { TYPE_HOTPLUG_HANDLER },
         { }
diff --git a/hw/usb/dev-storage-bot.c b/hw/usb/dev-storage-bot.c
index a7f8d80c17a..b156f1c5c9a 100644
--- a/hw/usb/dev-storage-bot.c
+++ b/hw/usb/dev-storage-bot.c
@@ -52,6 +52,7 @@ static const TypeInfo bot_info = {
     .name          = "usb-bot",
     .parent        = TYPE_USB_STORAGE,
     .class_init    = usb_msd_class_bot_initfn,
+    .secure        = true,
 };
 
 static void register_types(void)
diff --git a/hw/usb/dev-storage-classic.c b/hw/usb/dev-storage-classic.c
index 353f81dcc05..a244b5c8071 100644
--- a/hw/usb/dev-storage-classic.c
+++ b/hw/usb/dev-storage-classic.c
@@ -134,6 +134,7 @@ static const TypeInfo msd_info = {
     .parent        = TYPE_USB_STORAGE,
     .class_init    = usb_msd_class_storage_initfn,
     .instance_init = usb_msd_instance_init,
+    .secure        = true,
 };
 
 static void register_types(void)
diff --git a/hw/usb/hcd-xhci-nec.c b/hw/usb/hcd-xhci-nec.c
index 46839911f3f..070732be9a6 100644
--- a/hw/usb/hcd-xhci-nec.c
+++ b/hw/usb/hcd-xhci-nec.c
@@ -67,6 +67,7 @@ static const TypeInfo nec_xhci_info = {
     .instance_size = sizeof(XHCINecState),
     .instance_init = nec_xhci_instance_init,
     .class_init    = nec_xhci_class_init,
+    .secure        = true,
 };
 
 static void nec_xhci_register_types(void)
diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c
index b124251ae33..a3615b29fbd 100644
--- a/hw/usb/hcd-xhci-pci.c
+++ b/hw/usb/hcd-xhci-pci.c
@@ -298,6 +298,7 @@ static const TypeInfo qemu_xhci_info = {
     .parent        = TYPE_XHCI_PCI,
     .class_init    = qemu_xhci_class_init,
     .instance_init = qemu_xhci_instance_init,
+    .secure        = true,
 };
 
 static void xhci_register_types(void)
diff --git a/hw/usb/hcd-xhci-sysbus.c b/hw/usb/hcd-xhci-sysbus.c
index bbdd5fd64ab..8dd50fbbf13 100644
--- a/hw/usb/hcd-xhci-sysbus.c
+++ b/hw/usb/hcd-xhci-sysbus.c
@@ -112,7 +112,8 @@ static const TypeInfo xhci_sysbus_info = {
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(XHCISysbusState),
     .class_init    = xhci_sysbus_class_init,
-    .instance_init = xhci_sysbus_instance_init
+    .instance_init = xhci_sysbus_instance_init,
+    .secure        = true,
 };
 
 static void xhci_sysbus_register_types(void)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index b5cc1ad2ff5..aac7f6788e0 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -3718,6 +3718,7 @@ static const TypeInfo xhci_info = {
     .parent        = TYPE_DEVICE,
     .instance_size = sizeof(XHCIState),
     .class_init    = xhci_class_init,
+    .secure        = true,
 };
 
 static void xhci_register_types(void)
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 5a369e2ebf5..9c4980995a4 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -1839,6 +1839,7 @@ static const TypeInfo usb_host_dev_info = {
     .instance_size = sizeof(USBHostDevice),
     .class_init    = usb_host_class_initfn,
     .instance_init = usb_host_instance_init,
+    .secure        = true,
 };
 module_obj(TYPE_USB_HOST_DEVICE);
 module_kconfig(USB);
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index a666b1e8d7d..401c6f5767b 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -2655,6 +2655,7 @@ static const TypeInfo usbredir_dev_info = {
     .instance_size = sizeof(USBRedirDevice),
     .class_init    = usbredir_class_initfn,
     .instance_init = usbredir_instance_init,
+    .secure        = true,
 };
 module_obj(TYPE_USB_REDIR);
 module_kconfig(USB);
-- 
2.56.1



  parent reply	other threads:[~2026-11-13 18:44 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 18:42 [PATCH v3 00/26] Mark user creatable devices for secure for virt use case Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 01/26] hw: mark most virtio PCI devices as secure Daniel P. Berrangé
2026-11-16 13:05   ` Thomas Huth
2026-11-16 13:08   ` Marc-André Lureau
2026-11-13 18:42 ` [PATCH v3 02/26] hw: mark all virtio CCW " Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 03/26] hw: mark all vhost devices a secure Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 04/26] hw: mark most remaining virtio object types as secure Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 05/26] hw/vfio: mark all VFIO object classes " Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 06/26] hw/xen: mark all Xen related object types as being secure Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 07/26] hw/net: mark e1000, e1000e, rtl8139 & sPAPR VLAN as secure Daniel P. Berrangé
2026-11-13 18:42 ` Daniel P. Berrangé [this message]
2026-11-13 18:42 ` [PATCH v3 09/26] hw/watchdog: mark some watchdog devices " Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 10/26] hw/scsi: mark spapr SCSI controller " Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 11/26] hw/scsi: mark SCSI disk endpoint devices " Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 12/26] hw/ide: mark ICH9 and ide-hd/ide-cd " Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 13/26] hw: define most common PCI types " Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 14/26] hw/pci-host: mark common x86, ppc, arm and s390 PCI hosts " Daniel P. Berrangé
2026-11-16 13:12   ` Thomas Huth
2026-11-13 18:42 ` [PATCH v3 15/26] hw/display: mark bochs, ramfb and VGA " Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 16/26] hw/tpm: mark all TPM implementations " Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 17/26] hw/misc: mark pvpanic, vmcoreinfo " Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 18/26] hw/audio: mark Intel HDA devices & codecs " Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 19/26] hw/char: mark common serial / console devices " Daniel P. Berrangé
2026-11-16 13:19   ` Thomas Huth
2026-11-16 13:36   ` Philippe Mathieu-Daudé
2026-11-16 18:06     ` Daniel P. Berrangé
2026-11-16 21:18       ` Philippe Mathieu-Daudé
2026-11-13 18:42 ` [PATCH v3 20/26] hw/mem: mark nvdimm, pc-dimm & spapr-nvdimm " Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 21/26] hw/uefi: mark the EFI vars service " Daniel P. Berrangé
2026-11-16 13:20   ` Thomas Huth
2026-11-16 13:37   ` Philippe Mathieu-Daudé
2026-11-13 18:42 ` [PATCH v3 22/26] hw/acpi: mark erst, vmclock and vmgenid devices " Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 23/26] hw: mark KVM clock and RTC " Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 24/26] hw: device AMD, Intel and ARM IOMMUs " Daniel P. Berrangé
2026-11-16 13:21   ` Thomas Huth
2026-11-13 18:42 ` [PATCH v3 25/26] hw/input: mark PS/2 and PC Keyboard devices " Daniel P. Berrangé
2026-11-13 18:42 ` [PATCH v3 26/26] hw/i386: mark vmmouse / vmport " Daniel P. Berrangé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261113184254.2524253-9-berrange@redhat.com \
    --to=berrange@redhat.com \
    --cc=clg@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.