From: Paul Durrant <Paul.Durrant@citrix.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
Wei Liu <wei.liu2@citrix.com>, Jan Beulich <jbeulich@suse.com>,
Andrew Cooper <Andrew.Cooper3@citrix.com>
Subject: Re: [PATCH 7/8] viridian: define type for the 'virtual VP assist page'
Date: Wed, 31 Oct 2018 09:27:59 +0000 [thread overview]
Message-ID: <94614b91d0b34ee7aa9297d4f6ad3ed5@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <20181031085339.dc23onxvq4tug5ka@mac.citrite.net>
> -----Original Message-----
> From: Roger Pau Monne
> Sent: 31 October 2018 08:54
> To: Paul Durrant <Paul.Durrant@citrix.com>
> Cc: xen-devel@lists.xenproject.org; Andrew Cooper
> <Andrew.Cooper3@citrix.com>; Wei Liu <wei.liu2@citrix.com>; Jan Beulich
> <jbeulich@suse.com>
> Subject: Re: [Xen-devel] [PATCH 7/8] viridian: define type for the
> 'virtual VP assist page'
>
> On Tue, Oct 30, 2018 at 05:11:30PM +0000, Paul Durrant wrote:
> > > -----Original Message-----
> > > From: Roger Pau Monne
> > > Sent: 30 October 2018 17:09
> > > To: Paul Durrant <Paul.Durrant@citrix.com>
> > > Cc: xen-devel@lists.xenproject.org; Andrew Cooper
> > > <Andrew.Cooper3@citrix.com>; Wei Liu <wei.liu2@citrix.com>; Jan
> Beulich
> > > <jbeulich@suse.com>
> > > Subject: Re: [Xen-devel] [PATCH 7/8] viridian: define type for the
> > > 'virtual VP assist page'
> > >
> > > On Mon, Oct 29, 2018 at 06:02:10PM +0000, Paul Durrant wrote:
> > > > The specification [1] defines a type so we should use it, rather
> than
> > > just
> > > > OR-ing and AND-ing magic bits.
> > > >
> > > > No functional change.
> > > >
> > > > NOTE: The type defined in the specification does include an
> anonymous
> > > > sub-struct in the page type but, as we currently use only the
> > > first
> > > > element, the struct declaration has been omitted.
> > > >
> > > > [1] https://github.com/MicrosoftDocs/Virtualization-
> > >
> Documentation/raw/live/tlfs/Hypervisor%20Top%20Level%20Functional%20Specif
> > > ication%20v5.0C.pdf
> > > >
> > > > Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> > > > ---
> > > > Cc: Jan Beulich <jbeulich@suse.com>
> > > > Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> > > > Cc: Wei Liu <wei.liu2@citrix.com>
> > > > ---
> > > > xen/arch/x86/hvm/viridian/synic.c | 52 +++++++++++++++++++++++----
> ----
> > > -------
> > > > xen/include/asm-x86/hvm/viridian.h | 2 +-
> > > > 2 files changed, 33 insertions(+), 21 deletions(-)
> > > >
> > > > diff --git a/xen/arch/x86/hvm/viridian/synic.c
> > > b/xen/arch/x86/hvm/viridian/synic.c
> > > > index 3f043f34ee..735c4c897c 100644
> > > > --- a/xen/arch/x86/hvm/viridian/synic.c
> > > > +++ b/xen/arch/x86/hvm/viridian/synic.c
> > > > @@ -13,6 +13,18 @@
> > > > #include <asm/apic.h>
> > > > #include <asm/hvm/support.h>
> > > >
> > > > +typedef struct _HV_VIRTUAL_APIC_ASSIST
> > > > +{
> > > > + uint32_t no_eoi:1;
> > >
> > > Maybe bool:1 so you can use true/false?
> > >
> >
> > No, I'm very specifically using a 32-bit bitfield to match what the
> spec. says.
>
> Right, but no_eoi is a single flag on that bitfield, unless I'm
> missing something I think you could just use:
>
> typedef union _HV_VIRTUAL_APIC_ASSIST
> {
> struct {
> bool no_eoi:1;
> } fields;
> uint32_t raw;
> } HV_VIRTUAL_APIC_ASSIST;
>
> If you wish to access the raw value as a uint32_t while keeping access
> to individual flags easy. This union also has the advantage that
> adding new fields won't require you to adjust the size of the
> reserved_zero field.
>
Agreed it's easier from a coding PoV, but I still prefer to stick with bitfield definitions that span the full 32-bits to make it line up with the spec. (currently section 10.3.5). If Microsoft had actually put a struct definition there then I would use that, but as it is the layout illustration is all there is and I want to match it as closely as I can.
Paul
> Thanks, Roger.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-10-31 9:28 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-29 18:02 [PATCH 0/8] viridian cleanup Paul Durrant
2018-10-29 18:02 ` [PATCH 1/8] viridian: move the code into its own sub-directory Paul Durrant
2018-10-30 9:25 ` Jan Beulich
2018-10-31 10:17 ` Jan Beulich
2018-10-31 10:30 ` Paul Durrant
2018-10-29 18:02 ` [PATCH 1/2] x86/mm/p2m: don't needlessly limit MMIO mapping order to 4k Paul Durrant
2018-10-29 18:03 ` Paul Durrant
2018-10-29 18:02 ` [PATCH 2/2] iommu / p2m: add a page_order parameter to iommu_map/unmap_page() Paul Durrant
2018-10-29 18:03 ` Paul Durrant
2018-10-29 18:02 ` [PATCH 2/8] viridian: remove MSR perf counters Paul Durrant
2018-10-30 16:25 ` Roger Pau Monné
2018-10-29 18:02 ` [PATCH 3/8] viridian: remove comments referencing section number in the spec Paul Durrant
2018-10-30 16:34 ` Roger Pau Monné
2018-10-30 17:07 ` Paul Durrant
2018-10-29 18:02 ` [PATCH 4/8] viridian: remove duplicate union types Paul Durrant
2018-10-30 16:40 ` Roger Pau Monné
2018-10-30 17:03 ` Paul Durrant
2018-10-31 8:44 ` Roger Pau Monné
2018-10-29 18:02 ` [PATCH 5/8] viridian: separate interrupt related enlightenment implementations Paul Durrant
2018-10-30 16:52 ` Roger Pau Monné
2018-10-30 17:06 ` Paul Durrant
2018-10-29 18:02 ` [PATCH 6/8] viridian: separate time " Paul Durrant
2018-10-30 17:03 ` Roger Pau Monné
2018-10-30 17:08 ` Paul Durrant
2018-10-29 18:02 ` [PATCH 7/8] viridian: define type for the 'virtual VP assist page' Paul Durrant
2018-10-30 17:08 ` Roger Pau Monné
2018-10-30 17:11 ` Paul Durrant
2018-10-31 8:53 ` Roger Pau Monné
2018-10-31 9:27 ` Paul Durrant [this message]
2018-10-31 9:41 ` Jan Beulich
2018-10-31 10:01 ` Paul Durrant
2018-10-31 10:16 ` Jan Beulich
2018-10-29 18:02 ` [PATCH 8/8] viridian: introduce struct viridian_page Paul Durrant
2018-10-30 17:17 ` Roger Pau Monné
2018-10-30 17:25 ` Paul Durrant
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=94614b91d0b34ee7aa9297d4f6ad3ed5@AMSPEX02CL03.citrite.net \
--to=paul.durrant@citrix.com \
--cc=Andrew.Cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.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).