On 9/22/2026 14:42, Mukesh R wrote:
> On 9/22/26 10:49, Easwar Hariharan wrote:
>> On 9/21/2026 15:50, Mukesh R wrote:
>>> Add a new file to implement a kernel only virtual IOMMU that works
>>> with Microsoft Hyper-V hypervisor on privileged VMs aka root VMs. The
>>> hypervisor claims the IOMMU upon boot, and this driver communicates with
>>> it for creating and deleting paging domains, attaching of devices, mapping
>>> and unmapping of pages, etc. During boot, hypervisor automatically creates
>>> identity and blocked domains, so there is no need to do hypercalls to
>>> create them.  This is a kernel only driver and only supported on baremetal
>>> root (and not L1VH root) without any guest passthru support. Support
>>> for guest device passthru will be added incrementally.
>>>
>>> Signed-off-by: Mukesh R <[email protected]>
>>> ---
>>>   arch/x86/kernel/pci-dma.c            |   2 +
>>>   drivers/iommu/Kconfig                |   1 +
>>>   drivers/iommu/hyperv/Kconfig         |  15 +
>>>   drivers/iommu/hyperv/Makefile        |   1 +
>>>   drivers/iommu/hyperv/hv-iommu-root.c | 645 +++++++++++++++++++++++++++
>>>   include/asm-generic/mshyperv.h       |   3 +
>>>   include/linux/hyperv.h               |   6 +
>>>   7 files changed, 673 insertions(+)
>>>   create mode 100644 drivers/iommu/hyperv/Kconfig
>>>   create mode 100644 drivers/iommu/hyperv/hv-iommu-root.c
>>>

<snip>

>>> diff --git a/drivers/iommu/hyperv/hv-iommu-root.c 
>>> b/drivers/iommu/hyperv/hv-iommu-root.c
>>> new file mode 100644
>>> index 000000000000..a5268e0e52cc
>>> --- /dev/null
>>> +++ b/drivers/iommu/hyperv/hv-iommu-root.c
>>> @@ -0,0 +1,645 @@
>>> +// SPDX-License-Identifier: GPL-2.0
>>> +/*
>>> + * Hyper-V root vIOMMU driver.
>>> + * Copyright (C) 2026, Microsoft, Inc.
>>> + */

<snip>

>>> +
>>> +/*
>>> + * Currently, hypervisor does not provide list of devices it is using
>>> + * dynamically. So use this to allow users to manually specify devices that
>>> + * should be skipped. (eg. hypervisor debugger using some network device).
>>> + */
>>
>> Maybe a flag, say OwnedByHyp = 1 returned for the root equivalent of the 
>> guest driver's
>> GetLogicalDeviceProperty hypercall can solve this.
> 
> "hypervisor does not provide list of devices it is using dynamically"

Sorry, can you be more verbose? When I read this response yesterday, I thought 
by dynamically, you
meant at runtime, but on thinking this through, the current scheme doesn't help 
with that either.
You have to pass the kernel command-line parameter at boot because the IOMMU 
driver is built-in, and
so if a debugger is attached to the hypervisor "at runtime", your current 
scheme, just like my suggestion
for a flag returned by GetPhysicalDeviceProperty above, requires a reboot of 
the root partition.

> 

<snip>

>>>   #endif /* _HYPERV_H */
> 


Reply via email to