From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>, Paul Durrant <paul@xen.org>,
Wei Liu <wl@xen.org>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v5 1/3] x86/iommu: remove regions not to be mapped
Date: Thu, 25 Jan 2024 15:37:27 +0100 [thread overview]
Message-ID: <ZbJyJywf34uFxl0I@macbook> (raw)
In-Reply-To: <d39c739b-fe27-4471-94a9-b56734985a30@citrix.com>
On Thu, Jan 25, 2024 at 01:22:15PM +0000, Andrew Cooper wrote:
> On 25/01/2024 1:13 pm, Jan Beulich wrote:
> > On 25.01.2024 13:55, Andrew Cooper wrote:
> >> On 25/01/2024 12:37 pm, Roger Pau Monné wrote:
> >>> On Thu, Jan 25, 2024 at 12:13:01PM +0100, Jan Beulich wrote:
> >>>> On 25.01.2024 09:47, Roger Pau Monné wrote:
> >>>>> On Thu, Jan 25, 2024 at 09:34:40AM +0100, Jan Beulich wrote:
> >>>>>> On 24.01.2024 18:29, Roger Pau Monne wrote:
> >>>>>>> --- a/xen/arch/x86/hvm/io.c
> >>>>>>> +++ b/xen/arch/x86/hvm/io.c
> >>>>>>> @@ -369,6 +369,22 @@ bool vpci_is_mmcfg_address(const struct domain *d, paddr_t addr)
> >>>>>>> return vpci_mmcfg_find(d, addr);
> >>>>>>> }
> >>>>>>>
> >>>>>>> +int __hwdom_init vpci_subtract_mmcfg(const struct domain *d, struct rangeset *r)
> >>>>>>> +{
> >>>>>>> + const struct hvm_mmcfg *mmcfg;
> >>>>>>> +
> >>>>>>> + list_for_each_entry ( mmcfg, &d->arch.hvm.mmcfg_regions, next )
> >>>>>>> + {
> >>>>>>> + int rc = rangeset_remove_range(r, PFN_DOWN(mmcfg->addr),
> >>>>>>> + PFN_DOWN(mmcfg->addr + mmcfg->size - 1));
> >>>>>> Along the lines of this, ...
> >>>>>>
> >>>>>>> --- a/xen/arch/x86/setup.c
> >>>>>>> +++ b/xen/arch/x86/setup.c
> >>>>>>> @@ -2138,6 +2138,54 @@ int __hwdom_init xen_in_range(unsigned long mfn)
> >>>>>>> return 0;
> >>>>>>> }
> >>>>>>>
> >>>>>>> +int __hwdom_init remove_xen_ranges(struct rangeset *r)
> >>>>>>> +{
> >>>>>>> + paddr_t start, end;
> >>>>>>> + int rc;
> >>>>>>> +
> >>>>>>> + /* S3 resume code (and other real mode trampoline code) */
> >>>>>>> + rc = rangeset_remove_range(r, PFN_DOWN(bootsym_phys(trampoline_start)),
> >>>>>>> + PFN_DOWN(bootsym_phys(trampoline_end)) - 1);
> >>>>>> ... did you perhaps mean
> >>>>>>
> >>>>>> PFN_DOWN(bootsym_phys(trampoline_end) - 1));
> >>>>>>
> >>>>>> here (and then similarly below, except there the difference is benign I
> >>>>>> think, for the labels being page-aligned)?
> >>>>> They are all page aligned, so I didn't care much, but now that you
> >>>>> point it might be safer to do the subtraction from the address instead
> >>>>> of the frame number, just in case.
> >>>> Hmm, no, for me neither trampoline_end nor trampoline_start are page
> >>>> aligned. While bootsym_phys(trampoline_start) is, I don't think
> >>>> bootsym_phys(trampoline_end) normally would be (it might only be by
> >>>> coincidence).
> >>> Oh, so it had been a coincidence of the build I was using I guess then.
> >> trampoline_start has to be page aligned because of constraints from SIPI
> >> and S3 (cant remember which one is the 4k constraint, but it's in the
> >> comments).
> > What you're talking about is the copy of the trampoline code/data in
> > low memory. trampoline_{start,end} themselves point into the Xen image.
>
> True, but we're operating on bootsym_phys(trampoline_start) which had
> better be aligned.
>
> We hard-code (by virtue of only filling in 1 single 4k PTE in the
> pagetables) that the AP trampoline is 4k.
>
> The range here should be 4k only too, or we're (falsely) marking lowmem
> adjacent to the AP trampoline as a Xen range when it's not.
Hm, looking at zap_low_mappings() we do seem to possibly map more than
one page, in fact on my current build trampoline_end -
trampoline_start is 6528.
Thanks, Roger.
next prev parent reply other threads:[~2024-01-25 14:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-24 17:29 [PATCH v5 0/3] x86/iommu: improve setup time of hwdom IOMMU Roger Pau Monne
2024-01-24 17:29 ` [PATCH v5 1/3] x86/iommu: remove regions not to be mapped Roger Pau Monne
2024-01-25 8:34 ` Jan Beulich
2024-01-25 8:47 ` Roger Pau Monné
2024-01-25 11:13 ` Jan Beulich
2024-01-25 12:37 ` Roger Pau Monné
2024-01-25 12:55 ` Andrew Cooper
2024-01-25 13:13 ` Jan Beulich
2024-01-25 13:22 ` Andrew Cooper
2024-01-25 14:37 ` Roger Pau Monné [this message]
2024-01-25 13:26 ` [PATCH v6 " Roger Pau Monne
2024-01-25 13:36 ` Jan Beulich
2024-01-25 16:46 ` Jan Beulich
2024-01-29 16:23 ` Paul Durrant
2024-01-24 17:29 ` [PATCH v5 2/3] x86/iommu: switch hwdom IOMMU to use a rangeset Roger Pau Monne
2024-01-25 14:17 ` Jan Beulich
2024-01-29 16:28 ` Paul Durrant
2024-01-24 17:29 ` [PATCH v5 3/3] x86/iommu: cleanup unused functions Roger Pau Monne
2024-01-29 16:31 ` 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=ZbJyJywf34uFxl0I@macbook \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=paul@xen.org \
--cc=wl@xen.org \
--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 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.