Currently bus drivers like USB, Thunderbolt implement a custom version of the device "authorize" support to selectively allow/dis-allow device driver probing. This is used to avoid attacks by untrusted devices on unhardened drivers (i.e. drivers that do not expect malicious hardware). For confidential computing, like Intel TDX, a similar policy is needed because a confidential guest doesn't trust the host's devices. This patch kit attempts to unify the support for both. In the v1 version, we have submitted a proposal for a driver filter framework. But Greg asked us not to re-invent the wheel and reuse the authorized support from USB and Thunderbolt drivers. This patch series fixes this issue. You can find v1 version and related discussion in the following link (https://lore.kernel.org/lkml/YQrXhnHJCsTxiRcP@xxxxxxxxxxxxxxxxxxxx/T/) Please note that the following patches have dependency on TDX patches [1] and Confidential Computing support patches [2] from Tom Landecky. Mainly, dependency lies in usage of functions like tdx_early_init(), cc_platform_has(), etc. So they will be merged along with other TDX patches via x86 tree. But we have included it here for review and to give the complete picture on how device filter support is used. x86/tdx: Add device filter support for x86 TDX guest platform PCI: Initialize authorized attribute for confidential guest virtio: Initialize authorized attribute for confidential guest We are expecting to merge only following patches through the driver core process. driver core: Move the "authorized" attribute from USB/Thunderbolt to core driver core: Add common support to skip probe for un-authorized devices driver core: Allow arch to initialize the authorized attribute [1] - https://lore.kernel.org/lkml/20210916183550.15349-1-sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx/ [2] - https://lkml.org/lkml/2021/9/28/1143 Changes since v1: * Unified authorized support in driver core and added support for device filter. * Included the authorized attribute use case support (TDX device filter support) in this patch series. Kuppuswamy Sathyanarayanan (6): driver core: Move the "authorized" attribute from USB/Thunderbolt to core driver core: Add common support to skip probe for un-authorized devices driver core: Allow arch to initialize the authorized attribute virtio: Initialize authorized attribute for confidential guest x86/tdx: Add device filter support for x86 TDX guest platform PCI: Initialize authorized attribute for confidential guest arch/x86/include/asm/tdx.h | 9 ++++++ arch/x86/kernel/Makefile | 2 +- arch/x86/kernel/cc_platform.c | 20 ++++++++++++ arch/x86/kernel/cpu/intel.c | 1 + arch/x86/kernel/tdx-filter.c | 56 +++++++++++++++++++++++++++++++++ arch/x86/kernel/tdx.c | 2 ++ drivers/base/core.c | 7 +++++ drivers/base/dd.c | 5 +++ drivers/pci/probe.c | 4 +++ drivers/thunderbolt/domain.c | 7 +++-- drivers/thunderbolt/icm.c | 9 +++--- drivers/thunderbolt/switch.c | 18 +++++------ drivers/thunderbolt/tb.c | 2 +- drivers/thunderbolt/tb.h | 2 -- drivers/usb/core/driver.c | 3 +- drivers/usb/core/generic.c | 2 +- drivers/usb/core/hub.c | 8 ++--- drivers/usb/core/message.c | 2 +- drivers/usb/core/sysfs.c | 3 +- drivers/usb/core/usb.c | 10 +++++- drivers/virtio/virtio.c | 9 ++++++ include/linux/cc_platform.h | 10 ++++++ include/linux/device.h | 16 +++++++++- include/linux/device/bus.h | 4 +++ include/linux/usb.h | 6 ---- include/uapi/linux/virtio_ids.h | 8 +++++ 26 files changed, 187 insertions(+), 38 deletions(-) create mode 100644 arch/x86/kernel/tdx-filter.c -- 2.25.1