linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nuno Das Neves <nunodasneves@linux.microsoft.com>
To: Easwar Hariharan <eahariha@linux.microsoft.com>,
	linux-hyperv@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	iommu@lists.linux.dev, netdev@vger.kernel.org,
	linux-pci@vger.kernel.org, linux-arch@vger.kernel.org,
	virtualization@lists.linux.dev
Cc: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
	decui@microsoft.com, catalin.marinas@arm.com, will@kernel.org,
	luto@kernel.org, tglx@linutronix.de, mingo@redhat.com,
	bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org,
	hpa@zytor.com, seanjc@google.com, pbonzini@redhat.com,
	peterz@infradead.org, daniel.lezcano@linaro.org, joro@8bytes.org,
	robin.murphy@arm.com, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, lpieralisi@kernel.org,
	kw@linux.com, robh@kernel.org, bhelgaas@google.com,
	arnd@arndb.de, sgarzare@redhat.com,
	jinankjain@linux.microsoft.com, muminulrussell@gmail.com,
	skinsburskii@linux.microsoft.com, mukeshrathor@microsoft.com,
	tyhicks@linux.microsoft.com
Subject: Re: [PATCH 0/5] Add new headers for Hyper-V Dom0
Date: Thu, 31 Oct 2024 15:59:14 -0700	[thread overview]
Message-ID: <aecdc98c-1f12-4f17-b145-9f02aebc01c2@linux.microsoft.com> (raw)
In-Reply-To: <fc47d535-ed52-4ca5-80cc-30003efdd464@linux.microsoft.com>

On 10/31/2024 12:05 PM, Easwar Hariharan wrote:
> On 10/3/2024 12:50 PM, Nuno Das Neves wrote:
>> To support Hyper-V Dom0 (aka Linux as root partition), many new
>> definitions are required.
>>
>> The plan going forward is to directly import headers from
>> Hyper-V. This is a more maintainable way to import definitions
>> rather than via the TLFS doc. This patch series introduces
>> new headers (hvhdk.h, hvgdk.h, etc, see patch #3) directly
>> derived from Hyper-V code.
>>
>> This patch series replaces hyperv-tlfs.h with hvhdk.h, but only
>> in Microsoft-maintained Hyper-V code where they are needed. This
>> leaves the existing hyperv-tlfs.h in use elsewhere - notably for
>> Hyper-V enlightenments on KVM guests.
>>
>> An intermediary header "hv_defs.h" is introduced to conditionally
>> include either hyperv-tlfs.h or hvhdk.h. This is required because
>> several headers which today include hyperv-tlfs.h, are shared
>> between Hyper-V and KVM code (e.g. mshyperv.h).
>>
>> Summary:
>> Patch 1-2: Cleanup patches
>> Patch 3: Add the new headers (hvhdk.h, etc..) in include/hyperv/
>> Patch 4: Add hv_defs.h and use it in mshyperv.h, svm.h,
>>          hyperv_timer.h
>> Patch 5: Switch to the new headers, only in Hyper-V code
>>
>> Nuno Das Neves (5):
>>   hyperv: Move hv_connection_id to hyperv-tlfs.h
>>   hyperv: Remove unnecessary #includes
>>   hyperv: Add new Hyper-V headers
>>   hyperv: Add hv_defs.h to conditionally include hyperv-tlfs.h or
>>     hvhdk.h
>>   hyperv: Use hvhdk.h instead of hyperv-tlfs.h in Hyper-V code
>>

Hi Easwar, thanks for the questions. I will attempt to clarify.
> 
> What is the model for Hyper-V code that has both guest and host roles
> where the corresponding hypercalls are available for both? As I
> understand it, those are supposed to be in hvgdk*.h.
>

It's true that the naming of the files implies hvgdk*.h is for guests,
and hvhdk*.h (which includes hvgdk*.h), is for hosts/dom0. But I would
only take that as a rough guide.

The real reason for keeping these names is to make it a easier to copy
and maintain the definitions from the Windows code into Linux, by
keeping the provenance of exactly where they came from.

> For a specific example, IOMMU hypercalls can operate on stage 2 or stage
> 1 translations depending on the role of the (hyper) caller and the input
> values provided. Should a driver using these hypercalls import both
> hvhdk* and hvgdk*? What about hyperv-tlfs?
>

I'd recommend importing hvhdk.h since it contains everything you need
(including hvgdk*.h).

The goal of this patchset is to move away from hyperv-tlfs.h, because by
definition it should only contain definitions from the TLFS document.

> Patches 4 and 5 seem to draw a bright line between host and guest roles
> while the reality is more gray. Please do correct me if I'm wrong here,
> perhaps the picture would be clearer if Stas' suggestion of a new header
> file is implemented.
> 

Patches 4 and 5 introduce the new headers in a way that avoids any
potential impact on KVM and other non-Microsoft-maintained code.

The 'line' is not between guest and host, but between Microsoft-maintained
and non-Microsoft-maintained code.

Thanks,
Nuno

> Thanks,
> Easwar


      reply	other threads:[~2024-10-31 22:59 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-03 19:50 [PATCH 0/5] Add new headers for Hyper-V Dom0 Nuno Das Neves
2024-10-03 19:51 ` [PATCH 1/5] hyperv: Move hv_connection_id to hyperv-tlfs.h Nuno Das Neves
2024-10-07 16:24   ` Wei Liu
2024-10-03 19:51 ` [PATCH 2/5] hyperv: Remove unnecessary #includes Nuno Das Neves
2024-10-07 16:24   ` Wei Liu
2024-10-10 18:21   ` Michael Kelley
2024-10-31 18:47     ` Nuno Das Neves
2024-10-03 19:51 ` [PATCH 3/5] hyperv: Add new Hyper-V headers Nuno Das Neves
2024-10-10 18:21   ` Michael Kelley
2024-10-11  1:34     ` [EXTERNAL] " MUKESH RATHOR
2024-10-03 19:51 ` [PATCH 4/5] hyperv: Add hv_defs.h to conditionally include hyperv-tlfs.h or hvhdk.h Nuno Das Neves
2024-10-03 19:51 ` [PATCH 5/5] hyperv: Use hvhdk.h instead of hyperv-tlfs.h in Hyper-V code Nuno Das Neves
2024-10-04 15:58   ` Stanislav Kinsburskii
2024-10-05  0:07     ` Nuno Das Neves
2024-10-04 19:11   ` Simon Horman
2024-10-04 23:36     ` Nuno Das Neves
2024-10-04 21:55   ` kernel test robot
2024-10-05  1:54   ` kernel test robot
2024-10-07 16:26 ` [PATCH 0/5] Add new headers for Hyper-V Dom0 Wei Liu
2024-10-10 18:21 ` Michael Kelley
2024-10-11  1:34   ` [EXTERNAL] " MUKESH RATHOR
2024-10-23  0:04     ` Nuno Das Neves
2024-10-23 18:39       ` Michael Kelley
2024-10-23  0:51   ` Nuno Das Neves
2024-10-23 18:32     ` Michael Kelley
2024-10-31 19:05 ` Easwar Hariharan
2024-10-31 22:59   ` Nuno Das Neves [this message]

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=aecdc98c-1f12-4f17-b145-9f02aebc01c2@linux.microsoft.com \
    --to=nunodasneves@linux.microsoft.com \
    --cc=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=eahariha@linux.microsoft.com \
    --cc=edumazet@google.com \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=iommu@lists.linux.dev \
    --cc=jinankjain@linux.microsoft.com \
    --cc=joro@8bytes.org \
    --cc=kuba@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kw@linux.com \
    --cc=kys@microsoft.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=mukeshrathor@microsoft.com \
    --cc=muminulrussell@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=robh@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=seanjc@google.com \
    --cc=sgarzare@redhat.com \
    --cc=skinsburskii@linux.microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=tyhicks@linux.microsoft.com \
    --cc=virtualization@lists.linux.dev \
    --cc=wei.liu@kernel.org \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).