All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Connor Davis" <davisc@ainfosec.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
	"George Dunlap" <george.dunlap@citrix.com>,
	"Julien Grall" <julien@xen.org>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Connor Davis" <connojdavis@gmail.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v1 01/10] drivers/char: Add support for Xue USB3 debugger
Date: Wed, 22 Jun 2022 17:47:15 +0200	[thread overview]
Message-ID: <YrM5g3dLRJHTIVYt@mail-itl> (raw)
In-Reply-To: <9c7c11f5-be1e-f0ef-0659-48026675ec1a@suse.com>

[-- Attachment #1: Type: text/plain, Size: 2660 bytes --]

On Wed, Jun 15, 2022 at 04:25:54PM +0200, Jan Beulich wrote:
> On 07.06.2022 16:30, Marek Marczykowski-Górecki wrote:
> > From: Connor Davis <davisc@ainfosec.com>
> > --- /dev/null
> > +++ b/xen/drivers/char/xue.c
> > @@ -0,0 +1,957 @@
> > +/*
> > + * drivers/char/xue.c
> > + *
> > + * Xen port for the xue debugger
> 
> Since even here it's not spelled out - may I ask what "xue" actually
> stands for (assumng it's an acronym)?

Honestly, I don't know. That would be a question to Connor.

> > +/* Supported xHC PCI configurations */
> > +#define XUE_XHC_CLASSC 0xC0330ULL
> 
> While I'm not meaning to fully review the code in this file (for lack
> of knowledge on xhci), the two ULL suffixes above strike me as odd.
> Is there a specific reason these can't just be U?

I don't think so (that's just how it was in xue.h). Will adjust. The
same response applies to many other remarks.

> > +    /* ...we found it, so parse the BAR and map the registers */
> > +    bar0 = pci_conf_read32(xue->sbdf, PCI_BASE_ADDRESS_0);
> > +    bar1 = pci_conf_read32(xue->sbdf, PCI_BASE_ADDRESS_1);
> 
> What if there are multiple?

You mean two 32-bit BARs? I check for that below (refusing to use them).
Anyway, I don't think that's a thing in USB 3.0 controllers.


> > +    /* IO BARs not allowed; BAR must be 64-bit */
> > +    if ( (bar0 & 0x1) != 0 || ((bar0 & 0x6) >> 1) != 2 )

(...)

> > +    memset(xue, 0, sizeof(*xue));
> > +
> > +    xue->dbc_ctx = &ctx;
> > +    xue->dbc_erst = &erst;
> > +    xue->dbc_ering.trb = evt_trb;
> > +    xue->dbc_oring.trb = out_trb;
> > +    xue->dbc_iring.trb = in_trb;
> > +    xue->dbc_owork.buf = wrk_buf;
> > +    xue->dbc_str = str_buf;
> 
> Especially the page-sized entities want allocating dynamically here, as
> they won't be needed without the command line option requesting the use
> of this driver.

Are you okay with changing this only in patch 9, where I restructure those
buffers anyway?

> > +    xue_open(xue);
> 
> No check of return value?

Good catch, will adjust.

> > +    serial_register_uart(SERHND_DBGP, &xue_uart_driver, &xue_uart);
> > +}
> > +
> > +void xue_uart_dump(void)
> > +{
> > +    struct xue_uart *uart = &xue_uart;
> > +    struct xue *xue = &uart->xue;
> > +
> > +    xue_dump(xue);
> > +}
> 
> This function looks to be unused (and lacks a declaration).

It is unused, same as xue_dump(), but is extremely useful when
debugging. Should I put it behind something like #ifdef XUE_DEBUG,
accompanied with a comment about its purpose?

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2022-06-22 15:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07 14:30 [PATCH v1 00/10] Add Xue - console over USB 3 Debug Capability Marek Marczykowski-Górecki
2022-06-07 14:30 ` [PATCH v1 01/10] drivers/char: Add support for Xue USB3 debugger Marek Marczykowski-Górecki
2022-06-15 14:25   ` Jan Beulich
2022-06-22 15:47     ` Marek Marczykowski-Górecki [this message]
2022-06-23  9:29       ` Jan Beulich
2022-07-03 12:17         ` Marek Marczykowski-Górecki
2022-07-04  6:05           ` Jan Beulich
2022-07-04  9:27             ` Marek Marczykowski-Górecki
2022-07-04  9:36               ` Jan Beulich
2022-06-07 14:30 ` [PATCH v1 02/10] xue: reset XHCI ports when initializing dbc Marek Marczykowski-Górecki
2022-06-15 14:35   ` Jan Beulich
2022-06-07 14:30 ` [PATCH v1 03/10] xue: add support for selecting specific xhci Marek Marczykowski-Górecki
2022-06-15 14:40   ` Jan Beulich
2022-06-07 14:30 ` [PATCH v1 04/10] ehci-dbgp: fix selecting n-th ehci controller Marek Marczykowski-Górecki
2022-06-15 14:42   ` Jan Beulich
2022-06-07 14:30 ` [PATCH v1 05/10] console: support multiple serial console simultaneously Marek Marczykowski-Górecki
2022-06-07 14:30 ` [PATCH v1 06/10] IOMMU: add common API for device reserved memory Marek Marczykowski-Górecki
2022-06-07 14:30 ` [PATCH v1 07/10] IOMMU/VT-d: wire common device reserved memory API Marek Marczykowski-Górecki
2022-06-07 14:30 ` [PATCH v1 08/10] IOMMU/AMD: " Marek Marczykowski-Górecki
2022-06-07 14:30 ` [PATCH v1 09/10] xue: mark DMA buffers as reserved for the device Marek Marczykowski-Górecki
2022-06-07 14:30 ` [PATCH v1 10/10] xue: allow driving the rest of XHCI by a domain while Xen uses DbC Marek Marczykowski-Górecki
2022-06-07 18:48 ` [PATCH v1 00/10] Add Xue - console over USB 3 Debug Capability Tamas K Lengyel
2022-07-06  7:30 ` Henry Wang

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=YrM5g3dLRJHTIVYt@mail-itl \
    --to=marmarek@invisiblethingslab.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=connojdavis@gmail.com \
    --cc=davisc@ainfosec.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=roger.pau@citrix.com \
    --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.