qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, "Michael Tsirkin" <mst@redhat.com>,
	"Fan Ni" <fan.ni@samsung.com>,
	linux-cxl@vger.kernel.org, linuxarm@huawei.com,
	"Ira Weiny" <ira.weiny@intel.com>,
	"Michael Roth" <michael.roth@amd.com>,
	"Dave Jiang" <dave.jiang@intel.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Mike Maslenkin" <mike.maslenkin@gmail.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>
Subject: Re: [PATCH v6 6/7] hw/cxl/events: Add injection of DRAM events
Date: Mon, 22 May 2023 15:57:53 +0100	[thread overview]
Message-ID: <20230522155753.000072ed@huawei.com> (raw)
In-Reply-To: <b06ee1dc-6ddb-327d-1180-d139862f9173@linaro.org>

On Fri, 19 May 2023 17:57:31 +0200
Philippe Mathieu-Daudé <philmd@linaro.org> wrote:

> On 19/5/23 17:45, Jonathan Cameron wrote:
> > On Fri, 19 May 2023 17:34:20 +0200
> > Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> >   
> >> Hi Jonathan,
> >>
> >> On 19/5/23 16:30, Jonathan Cameron wrote:  
> >>> Defined in CXL r3.0 8.2.9.2.1.2 DRAM Event Record, this event
> >>> provides information related to DRAM devices.
> >>>
> >>> Example injection command in QMP:
> >>>
> >>> { "execute": "cxl-inject-dram-event",
> >>>       "arguments": {
> >>>           "path": "/machine/peripheral/cxl-mem0",
> >>>           "log": "informational",
> >>>           "flags": 1,
> >>>           "physaddr": 1000,
> >>>           "descriptor": 3,
> >>>           "type": 3,
> >>>           "transaction-type": 192,
> >>>           "channel": 3,
> >>>           "rank": 17,
> >>>           "nibble-mask": 37421234,
> >>>           "bank-group": 7,
> >>>           "bank": 11,
> >>>           "row": 2,
> >>>           "column": 77,
> >>>           "correction-mask": [33, 44, 55,66]
> >>>       }}
> >>>
> >>> Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> >>> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >>> ---
> >>>    hw/mem/cxl_type3.c          | 116 ++++++++++++++++++++++++++++++++++++
> >>>    hw/mem/cxl_type3_stubs.c    |  13 ++++
> >>>    include/hw/cxl/cxl_events.h |  23 +++++++
> >>>    qapi/cxl.json               |  35 +++++++++++
> >>>    4 files changed, 187 insertions(+)  
> >>
> >>  
> >>> diff --git a/qapi/cxl.json b/qapi/cxl.json
> >>> index 7e1e6257ce..5e82097e76 100644
> >>> --- a/qapi/cxl.json
> >>> +++ b/qapi/cxl.json
> >>> @@ -55,6 +55,41 @@
> >>>                '*device': 'uint32', '*component-id': 'str'
> >>>                }}
> >>>    
> >>> +##
> >>> +# @cxl-inject-dram-event:
> >>> +#
> >>> +# Inject an event record for a DRAM Event (CXL r3.0 8.2.9.2.1.2)
> >>> +# This event type is reported via one of the event logs specified via
> >>> +# the log parameter.
> >>> +#
> >>> +# @path: CXL type 3 device canonical QOM path
> >>> +# @log: Event Log to add the event to
> >>> +# @flags: header flags
> >>> +# @physaddr: Physical Address  
> >>
> >> Could this be a clearer description?
> >>
> >> "Physical Address (relative to @path device)"  
> > 
> > Makes sense.

This got changed to dpa to avoid some confusion with other uses of
address and DPA is tightly defined in the CXL specification.

> >   
> >>  
> >>> +# @descriptor: Descriptor
> >>> +# @type: Type
> >>> +# @transaction-type: Transaction Type
> >>> +# @channel: Channel
> >>> +# @rank: Rank
> >>> +# @nibble-mask: Identify one or more nibbles that the error affects  
> >>  
> >>> +# @bank-group: Bank group
> >>> +# @bank: Bank
> >>> +# @row: Row
> >>> +# @column: Column  
> >>
> >> Why do we need bank/raw/col if we have physaddr?  
> > 
> > Yes we need them. We don't know the device geometry / internal interleaving
> > / address hashing applied to smooth out access patterns etc.
> > 
> > I really don't want to put that level of complexity into the command
> > line for a device - so just left it to the test tools to squirt in
> > something valid.
> >   
> >>
> >> These are optional. Shouldn't we check they are valid
> >> in qmp_cxl_inject_dram_event()? (No clue, just wondering
> >> if there is some duplication here).  
> > 
> > Validation is really hard for these as depends on the above
> > device implementation complexity.  There is a note on trying to
> > strike the balance in the cover letter. I'm not sure I have it
> > right! They are optional in records coming from the device, so
> > we set validity flags for them in the device record.
> > 
> > Aim here is to be able to inject whatever might be seen on a real device
> > without having to have QEMU emulate a bunch of device internals
> > such as mappings to particular DRAM FRU, chip, column, row etc.  
> 
> I was expecting some check like:
> 
>    ROUND_DOWN(physaddr, 8) == bank * row * column * 8
> 
Got it.  That doesn't work unfortunately because there may well be a bunch
of interleaving and hashing inbetween.

> But indeed this isn't really useful for your tests, since we want to
> check sanity for values from the guest, not from human via QMP.
> So FWIW overall LGTM.

Great

Jonathan
> 
> > 
> >   
> >>  
> >>> +# @correction-mask: Bits within each nibble. Used in order of bits set
> >>> +#                   in the nibble-mask.  Up to 4 nibbles may be covered.
> >>> +#
> >>> +# Since: 8.1
> >>> +##
> >>> +{ 'command': 'cxl-inject-dram-event',
> >>> +  'data': { 'path': 'str', 'log': 'CxlEventLog', 'flags': 'uint8',
> >>> +            'physaddr': 'uint64', 'descriptor': 'uint8',
> >>> +            'type': 'uint8', 'transaction-type': 'uint8',
> >>> +            '*channel': 'uint8', '*rank': 'uint8', '*nibble-mask': 'uint32',
> >>> +            '*bank-group': 'uint8', '*bank': 'uint8', '*row': 'uint32',
> >>> +            '*column': 'uint16', '*correction-mask': [ 'uint64' ]
> >>> +           }}
> >>> +
> >>>    ##
> >>>    # @cxl-inject-poison:
> >>>    #  
> >>  
> >   
> 



  reply	other threads:[~2023-05-22 14:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19 14:30 [PATCH v6 0/7] QEMU CXL Provide mock CXL events and irq support Jonathan Cameron via
2023-05-19 14:30 ` [PATCH v6 1/7] hw/cxl/events: Add event status register Jonathan Cameron via
2023-05-19 14:30 ` [PATCH v6 2/7] hw/cxl: Move CXLRetCode definition to cxl_device.h Jonathan Cameron via
2023-05-19 14:30 ` [PATCH v6 3/7] hw/cxl/events: Wire up get/clear event mailbox commands Jonathan Cameron via
2023-05-19 14:30 ` [PATCH v6 4/7] hw/cxl/events: Add event interrupt support Jonathan Cameron via
2023-05-19 14:30 ` [PATCH v6 5/7] hw/cxl/events: Add injection of General Media Events Jonathan Cameron via
2023-05-19 14:30 ` [PATCH v6 6/7] hw/cxl/events: Add injection of DRAM events Jonathan Cameron via
2023-05-19 15:34   ` Philippe Mathieu-Daudé
2023-05-19 15:45     ` Jonathan Cameron via
2023-05-19 15:57       ` Philippe Mathieu-Daudé
2023-05-22 14:57         ` Jonathan Cameron via [this message]
2023-05-23 13:56       ` Ira Weiny
2023-05-19 14:30 ` [PATCH v6 7/7] hw/cxl/events: Add injection of Memory Module Events Jonathan Cameron via

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=20230522155753.000072ed@huawei.com \
    --to=qemu-devel@nongnu.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dave.jiang@intel.com \
    --cc=eblake@redhat.com \
    --cc=fan.ni@samsung.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=mike.maslenkin@gmail.com \
    --cc=mst@redhat.com \
    --cc=philmd@linaro.org \
    --cc=thuth@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).