Generic Linux architectural discussions
 help / color / mirror / Atom feed
From: Mukesh R <mrathor@linux.microsoft.com>
To: Yu Zhang <zhangyu1@linux.microsoft.com>
Cc: linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org,
	iommu@lists.linux.dev, linux-pci@vger.kernel.org,
	linux-arch@vger.kernel.org, x86@kernel.org, wei.liu@kernel.org,
	kys@microsoft.com, haiyangz@microsoft.com, decui@microsoft.com,
	longli@microsoft.com, joro@8bytes.org, will@kernel.org,
	robin.murphy@arm.com, bhelgaas@google.com,
	kwilczynski@kernel.org, lpieralisi@kernel.org, mani@kernel.org,
	robh@kernel.org, arnd@arndb.de, jgg@ziepe.ca,
	mhklinux@outlook.com, jacob.pan@linux.microsoft.com,
	tgopinath@linux.microsoft.com,
	easwar.hariharan@linux.microsoft.com, baolu.lu@linux.intel.com,
	suravee.suthikulpanit@amd.com, vasant.hegde@amd.com
Subject: Re: [PATCH v5 4/5] iommu/hyperv: Add para-virtualized IOMMU support for Hyper-V guest
Date: Mon, 7 Sep 2026 14:08:35 -0700	[thread overview]
Message-ID: <421b3805-5b90-dfc9-b84c-ee58969f5e36@linux.microsoft.com> (raw)
In-Reply-To: <re2lmz757bvtzbkylxtsj7zu2pjqz7ro752tcg7bpjaicuj6ml@mgsg6jnvgbyd>

On 9/7/26 01:41, Yu Zhang wrote:
> <snip>
> 
>>> +{
>>> +	u64 status;
>>> +	u32 prefix;
>>> +	unsigned long flags;
>>> +	int ret;
>>> +	struct pci_dev *pdev = to_pci_dev(dev);
>>> +	struct hv_input_get_logical_device_property *input;
>>> +	struct hv_output_get_logical_device_property *output;
>>> +
>>> +	ret = hv_pci_lookup_dev_id(pci_domain_nr(pdev->bus), &prefix);
>>> +	if (ret)
>>> +		return ret;
>>> +
>>> +	local_irq_save(flags);
>>> +
>>> +	input = *this_cpu_ptr(hyperv_pcpu_input_arg);
>>> +	output = (struct hv_output_get_logical_device_property *)(input + 1);
>>
>> Any reason for not using pcpu output arg like we do in all other places?
>> If there is a technical reason, please document it, otherwise when revisited
>> in future for re-design, anyone looking at this will be confused and
>> waste time investigating if there is anything different about this hypercall.
>>
>>
> 
> Thank you, Mukesh. I had also incorrectly assumed that output required
> a separate page, which is why the RFC included a separate output-page
> allocation patch. Michael clarified during that review [1] that input
> and output can share a page as long as their buffers do not overlap,
> so I dropped that patch latter.

They can share a page, but we don't enforce the sizes combined do
not overflow a page, and that could be an issue in future. There is
a tool on the hyp side i believe to check that input and output struct
sizes do not exceed page size.

Also, both the input and output pages are pre-allocated, so there is no
extra allocation (otherwise, we'd have changed all places by now). So
it's better to just follow the convention we've so far just to avoid
confusion during future redesign imo. We def need to revisit this in
near/medium future for all hypercalls.

Thanks,
-Mukesh

> Actually, there's nothing specific to this hypercall here - it follows
> the existing usage. E.g., hv_pci_read_mmio() already uses such arrangement,
> as Michael noted in [2]. pvIOMMU queries fit within the existing per-CPU
> page, with output placed after input, avoiding an unnecessary allocation.
>                                                                           
> [1] https://lore.kernel.org/all/SN6PR02MB4157C3EF6617A7BA4CA9E432D485A@SN6PR02MB4157.namprd02.prod.outlook.com/
> [2] https://lore.kernel.org/all/SN6PR02MB4157BF936EBDA23AD1EC5183D480A@SN6PR02MB4157.namprd02.prod.outlook.com/
>                                                                                                                 
> B.R.
> Yu


  reply	other threads:[~2026-09-07 21:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04  7:55 [PATCH v5 0/5] Hyper-V: Add para-virtualized IOMMU support for Linux guests Yu Zhang
2026-09-04  7:55 ` [PATCH v5 1/5] hyperv: Introduce new hypercall interfaces used by Hyper-V guest IOMMU Yu Zhang
2026-09-04  7:55 ` [PATCH v5 2/5] Drivers: hv: Add logical device ID registry for vPCI devices Yu Zhang
2026-09-04  7:55 ` [PATCH v5 3/5] iommu/x86: Add architectural MSI reserved region helper Yu Zhang
2026-09-04  7:55 ` [PATCH v5 4/5] iommu/hyperv: Add para-virtualized IOMMU support for Hyper-V guest Yu Zhang
2026-09-05  2:15   ` Mukesh R
2026-09-07  8:41     ` Yu Zhang
2026-09-07 21:08       ` Mukesh R [this message]
2026-09-08  3:16         ` Yu Zhang
2026-09-08 23:44           ` Mukesh R
2026-09-04  7:55 ` [PATCH v5 5/5] iommu/hyperv: Add page-selective IOTLB flush support Yu Zhang
2026-09-04 14:53   ` Michael Kelley
2026-09-07  8:48 ` [PATCH v5 0/5] Hyper-V: Add para-virtualized IOMMU support for Linux guests Yu Zhang

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=421b3805-5b90-dfc9-b84c-ee58969f5e36@linux.microsoft.com \
    --to=mrathor@linux.microsoft.com \
    --cc=arnd@arndb.de \
    --cc=baolu.lu@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=decui@microsoft.com \
    --cc=easwar.hariharan@linux.microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=iommu@lists.linux.dev \
    --cc=jacob.pan@linux.microsoft.com \
    --cc=jgg@ziepe.ca \
    --cc=joro@8bytes.org \
    --cc=kwilczynski@kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=mhklinux@outlook.com \
    --cc=robh@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=tgopinath@linux.microsoft.com \
    --cc=vasant.hegde@amd.com \
    --cc=wei.liu@kernel.org \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    --cc=zhangyu1@linux.microsoft.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox