From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
George Dunlap <george.dunlap@citrix.com>,
Julien Grall <julien@xen.org>,
Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 2/2] drivers/char: Use sub-page ro API to make just xhci dbc cap RO
Date: Sat, 1 Jul 2023 00:38:26 +0200 [thread overview]
Message-ID: <ZJ9ZYjWoiPU7GFuV@mail-itl> (raw)
In-Reply-To: <f168a753-45d2-7d66-8ec7-ad06e6cd42eb@suse.com>
[-- Attachment #1: Type: text/plain, Size: 2715 bytes --]
On Tue, May 30, 2023 at 02:04:26PM +0200, Jan Beulich wrote:
> On 05.05.2023 23:25, Marek Marczykowski-Górecki wrote:
> > Not the whole page, which may contain other registers too. In fact
> > on Tiger Lake and newer (at least), this page do contain other registers
> > that Linux tries to use.
>
> Please can you clarify whether this is with spec or an erratum?
It is in spec. The spec is written with assumption that different driver
may drive the debug console than the rest of the controller. But the
spec (apparently) does not anticipate those drivers living in different
kernels, so does not mandate isolating registers to separate pages.
> I ask
> not the least because I continue to wonder whether we really want/need
> the non-negligible amount of new code added by path 1.
>
> > And with share=yes, a domU would use them too.
>
> And gain yet more access to the emulator, as mentioned in patch 1. The
> security implications may (will?) want mentioning.
>
> > --- a/xen/drivers/char/xhci-dbc.c
> > +++ b/xen/drivers/char/xhci-dbc.c
> > @@ -1221,14 +1221,12 @@ static void __init cf_check dbc_uart_init_postirq(struct serial_port *port)
> > * Linux's XHCI driver (as of 5.18) works without writting to the whole
> > * page, so keep it simple.
> > */
> > - if ( rangeset_add_range(mmio_ro_ranges,
> > - PFN_DOWN((uart->dbc.bar_val & PCI_BASE_ADDRESS_MEM_MASK) +
> > - uart->dbc.xhc_dbc_offset),
> > - PFN_UP((uart->dbc.bar_val & PCI_BASE_ADDRESS_MEM_MASK) +
> > - uart->dbc.xhc_dbc_offset +
> > - sizeof(*uart->dbc.dbc_reg)) - 1) )
> > - printk(XENLOG_INFO
> > - "Error while adding MMIO range of device to mmio_ro_ranges\n");
> > + if ( subpage_mmio_ro_add(
> > + (uart->dbc.bar_val & PCI_BASE_ADDRESS_MEM_MASK) +
> > + uart->dbc.xhc_dbc_offset,
> > + sizeof(*uart->dbc.dbc_reg)) )
> > + printk(XENLOG_WARNING
> > + "Error while marking MMIO range of XHCI console as R/O\n");
>
> So how about falling back to just rangeset_add_range(mmio_ro_ranges, ...)
> in this failure case? (I did mention an alternative to doing it here in
> the comments on patch 1.)
Or fallback to XHCI_SHARE_NONE (IOW, pci_ro_device()).
> Also, doesn't the comment ahead of the construct become stale?
Indeed.
> Finally I think indentation of the function call arguments is off by one.
How is it supposed to be? Currently it's 8 spaces over the "if", should
it be 4 spaces over the function name?
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2023-06-30 22:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-05 21:25 [PATCH v2 0/2] Add API for making parts of a MMIO page R/O and use it in XHCI console Marek Marczykowski-Górecki
2023-05-05 21:25 ` [PATCH v2 1/2] x86/mm: add API for marking only part of a MMIO page read only Marek Marczykowski-Górecki
2023-05-17 19:28 ` Jason Andryuk
2023-05-30 11:56 ` Jan Beulich
2023-06-30 22:28 ` Marek Marczykowski-Górecki
2023-07-05 8:23 ` Jan Beulich
2023-07-07 11:02 ` Marek Marczykowski-Górecki
2023-07-10 7:04 ` Jan Beulich
2023-05-05 21:25 ` [PATCH v2 2/2] drivers/char: Use sub-page ro API to make just xhci dbc cap RO Marek Marczykowski-Górecki
2023-05-30 12:04 ` Jan Beulich
2023-06-30 22:38 ` Marek Marczykowski-Górecki [this message]
2023-07-05 8:28 ` Jan Beulich
2023-05-11 14:58 ` [PATCH v2 0/2] Add API for making parts of a MMIO page R/O and use it in XHCI console Jason Andryuk
2023-05-11 15:22 ` Marek Marczykowski-Górecki
2023-05-11 15:27 ` Jason Andryuk
2023-05-11 15:28 ` Marek Marczykowski-Górecki
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=ZJ9ZYjWoiPU7GFuV@mail-itl \
--to=marmarek@invisiblethingslab.com \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=sstabellini@kernel.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.