All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 2/6] amd-vi: set IOMMU page table levels based on guest reported paddr width
Date: Tue, 5 Dec 2023 16:11:08 +0100	[thread overview]
Message-ID: <ZW89jMz1yaD4qLN9@macbook> (raw)
In-Reply-To: <17de355f-623f-4310-ac55-df028235c240@suse.com>

On Tue, Dec 05, 2023 at 03:32:20PM +0100, Jan Beulich wrote:
> On 04.12.2023 10:43, Roger Pau Monne wrote:
> > --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
> > +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
> > @@ -359,21 +359,17 @@ int __read_mostly amd_iommu_min_paging_mode = 1;
> >  static int cf_check amd_iommu_domain_init(struct domain *d)
> >  {
> >      struct domain_iommu *hd = dom_iommu(d);
> > +    int pglvl = amd_iommu_get_paging_mode(
> > +                PFN_DOWN(1UL << paging_max_paddr_bits(d)));
> 
> This is a function in the paging subsystem, i.e. generally inapplicable
> to system domains (specifically DomIO). If this is to remain this way,
> the function would imo need to gain a warning. Yet better would imo be
> if the function was avoided for system domains.

I have to admit I'm confused, won't systems domains return
paging_mode_hap(d) == false, and thus fallback to using paddr_bits
(host paddr width?).

I can avoid such domains calling into paging_max_paddr_bits() but it
seems redundant, and would just be duplicated logic for a case that
paging_max_paddr_bits() already handles correctly AFAICT.

Would it be better for me to rename paging_max_paddr_bits() to
domain_max_paddr_bits() and move it to asm/domain.h?

Thanks, Roger.


  reply	other threads:[~2023-12-05 15:11 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04  9:42 [PATCH v2 0/6] x86/iommu: improve setup time of hwdom IOMMU Roger Pau Monne
2023-12-04  9:43 ` [PATCH v2 1/6] iommu/vt-d: do not assume page table levels for quarantine domain Roger Pau Monne
2023-12-05 14:24   ` Jan Beulich
2023-12-05 14:30     ` Roger Pau Monné
2023-12-04  9:43 ` [PATCH v2 2/6] amd-vi: set IOMMU page table levels based on guest reported paddr width Roger Pau Monne
2023-12-05 14:32   ` Jan Beulich
2023-12-05 15:11     ` Roger Pau Monné [this message]
2023-12-05 15:19       ` Jan Beulich
2023-12-04  9:43 ` [PATCH v2 3/6] x86/iommu: introduce a rangeset to perform hwdom IOMMU setup Roger Pau Monne
2023-12-05 14:50   ` Jan Beulich
2023-12-05 15:29     ` Roger Pau Monné
2023-12-04  9:43 ` [PATCH v2 4/6] x86/iommu: remove regions not to be mapped Roger Pau Monne
2023-12-05 15:11   ` Jan Beulich
2023-12-05 15:31     ` Roger Pau Monné
2023-12-05 15:34       ` Jan Beulich
2023-12-04  9:43 ` [PATCH v2 5/6] x86/iommu: switch hwdom IOMMU to use a rangeset Roger Pau Monne
2023-12-05 15:27   ` Jan Beulich
2023-12-05 15:43     ` Roger Pau Monné
2023-12-05 15:47       ` Jan Beulich
2023-12-05 16:07         ` Roger Pau Monné
2023-12-04  9:43 ` [PATCH v2 6/6] x86/iommu: cleanup unused functions Roger Pau Monne
2023-12-05 15:29   ` Jan Beulich
2023-12-05 15:48     ` Roger Pau Monné
2023-12-05 15:52       ` 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=ZW89jMz1yaD4qLN9@macbook \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.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 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.