All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: andrew.cooper3@citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH] x86/PCI: Intercept Dom0 MMCFG from dom0s in HVM containers
Date: Wed, 16 Dec 2015 07:47:43 -0700	[thread overview]
Message-ID: <5671879F02000078000C0451@prv-mh.provo.novell.com> (raw)
In-Reply-To: <56716F89.8080306@oracle.com>

>>> On 16.12.15 at 15:04, <boris.ostrovsky@oracle.com> wrote:
> On 12/16/2015 04:04 AM, Jan Beulich wrote:
>>>>> On 15.12.15 at 22:02,<boris.ostrovsky@oracle.com>  wrote:
>>> --- a/xen/arch/x86/hvm/emulate.c
>>> +++ b/xen/arch/x86/hvm/emulate.c
>>> @@ -1778,6 +1778,28 @@ int hvm_emulate_one_no_write(
>>>       return _hvm_emulate_one(hvmemul_ctxt, &hvm_emulate_ops_no_write);
>>>   }
>>>   
>>> +static const struct x86_emulate_ops hvm_emulate_ops_mmio = {
>>> +    .read       = mmio_ro_emulated_read,
>>> +    .insn_fetch = hvmemul_insn_fetch,
>>> +    .write      = mmio_intercept_write,
>>> +};
>> Blank line missing here, but as a probably better alternative this could
>> move into the function below.
>>
>>> +int hvm_emulate_one_mmio(unsigned seg, unsigned bdf, unsigned long gla)
>> Name and function parameters don't match up (also for e.g. the
>> changed struct mmio_ro_emulate_ctxt). DYM e.g.
>> hvm_emulate_one_mmcfg()?
> 
> Yes. I in fact first named it *_mmcfg() and then renamed it to _*mmio(). 
> But then by the same logic wouldn't we want to rename 
> mmio_intercept_write() as well, not necessarily because of arguments but 
> because of what it actually does?

We might. I named it that way just to match its neighbors.

> I am not sure what you mean by your statement in parentheses about 
> mmio_ro_emulate_ctxt.

I simply hinted at this also likely needing s/mmio/mmcfg/.

>> (The function naming in x86/mm.c
>> is actually using mmio because its serving wider purpose than
>> just MMCFG write interception. Which makes me wonder whether
>> we don't actually need that other part for PVH too, in which case
>> the naming would again be fine.)
> 
> I don't think I understand what the other part is used for in PV so I 
> don't know whether it is useful for PVH.

It discards writes to the config space of r/o devices.

>>> +{
>>> +    struct mmio_ro_emulate_ctxt mmio_ro_ctxt = {
>>> +        .cr2 = gla,
>>> +        .seg = seg,
>>> +        .bdf = bdf
>>> +    };
>>> +    struct hvm_emulate_ctxt ctxt = { .ctxt.data = &mmio_ro_ctxt };
>> hvm_mem_access_emulate_one() so far is the only example pre-
>> initializing ctxt before calling hvm_emulate_prepare(), and I don't
>> think it actually needs this. I think the proper place to set .data is
>> after the call to hvm_emulate_prepare().
> 
> I used hvm_emulate_prepare() as a convenient way to initialize the 
> context to a reasonable state, with definition of "reasonable" possibly 
> changing at some point later. Other emulating routines have 
> hvm_emulate_ctxt passed in so it may already have certain fields set.

Oh, I wasn't questioning that part - you certainly need to use that
function. I was questioning the zero-initialization of all the fields
other than .data prior to calling this function.

Jan

  reply	other threads:[~2015-12-16 14:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-15 21:02 [PATCH] x86/PCI: Intercept Dom0 MMCFG from dom0s in HVM containers Boris Ostrovsky
2015-12-16  9:04 ` Jan Beulich
2015-12-16 14:04   ` Boris Ostrovsky
2015-12-16 14:47     ` Jan Beulich [this message]
2015-12-16 19:34   ` Boris Ostrovsky
2015-12-17  9:46     ` Jan Beulich
2015-12-17 13:55       ` Boris Ostrovsky
2015-12-17 13:59         ` Jan Beulich

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=5671879F02000078000C0451@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.