All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: Hendrik Wuethrich <whendrik@google.com>
Cc: <qemu-devel@nongnu.org>, <eduardo@habkost.net>,
	<richard.henderson@linaro.org>, <marcel.apfelbaum@gmail.com>,
	<mst@redhat.com>, <pbonzini@redhat.com>, <zhao1.liu@intel.com>,
	<xiaoyao.li@intel.com>, <peternewman@google.com>
Subject: Re: [PATCH v5 1/8] i386: Add Intel RDT device and State to config.
Date: Thu, 20 Feb 2025 15:41:25 +0000	[thread overview]
Message-ID: <20250220154125.00007a08@huawei.com> (raw)
In-Reply-To: <20241213172645.2751696-2-whendrik@google.com>

On Fri, 13 Dec 2024 17:26:38 +0000
Hendrik Wuethrich <whendrik@google.com> wrote:

> From: ‪Hendrik Wüthrich <whendrik@google.com>
> 
> Change config to show RDT, add minimal code to the rdt.c module to make
> sure things still compile.
> 
> Signed-off-by: Hendrik Wüthrich <whendrik@google.com>
Hi,

A few drive by comments.

> ---
>  hw/i386/Kconfig       |  4 ++
>  hw/i386/meson.build   |  1 +
>  hw/i386/rdt.c         | 99 +++++++++++++++++++++++++++++++++++++++++++
>  include/hw/i386/rdt.h | 25 +++++++++++
>  target/i386/cpu.h     |  3 ++
>  5 files changed, 132 insertions(+)
>  create mode 100644 hw/i386/rdt.c
>  create mode 100644 include/hw/i386/rdt.h

> diff --git a/hw/i386/rdt.c b/hw/i386/rdt.c
> new file mode 100644
> index 0000000000..b2203197e3
> --- /dev/null
> +++ b/hw/i386/rdt.c
> @@ -0,0 +1,99 @@
> +/*
> + * Intel Resource Director Technology (RDT).
> + *
> + * Copyright 2024 Google LLC
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
> + * for more details.
> + */
> +
> +#include "hw/i386/rdt.h"
> +#include "qemu/osdep.h" /* Needs to be included before isa.h */
> +#include "hw/isa/isa.h"
> +#include "hw/qdev-properties.h"
> +#include "qom/object.h"
> +
> +/* Max counts for allocation masks or CBMs. In other words, the size of
> + * respective MSRs.
> + * L3_MASK and L3_mask are architectural limitations. THRTL_COUNT is just
> + * the space left until the next MSR.
> + * */


Should match multiline comment style in qemu style guide.

> +
> +/*One instance of RDT-internal state to be shared by all cores*/
> +struct RDTState {
> +    ISADevice parent;
> +
> +    /*Max amount of RMIDs*/

Spaces typically after * and before * I think are most common
syntax for comments in qEMU

> +    uint32_t rmids;
> +
> +    /*Per core state*/
> +    RDTStatePerCore *rdtInstances;
> +    RDTAllocation *allocations;
> +
> +    /*RDT Allocation bitmask MSRs*/
> +    uint32_t msr_L3_ia32_mask_n[RDT_MAX_L3_MASK_COUNT];
> +    uint32_t msr_L2_ia32_mask_n[RDT_MAX_L2_MASK_COUNT];
> +    uint32_t ia32_L2_qos_ext_bw_thrtl_n[RDT_MAX_MBA_THRTL_COUNT];
> +};
> +
> +struct RDTStateClass {
> +};
> +
> +OBJECT_DEFINE_TYPE(RDTState, rdt, RDT, ISA_DEVICE);
> +
> +static Property rdt_properties[] = {
> +    DEFINE_PROP_UINT32(RDT_NUM_RMID_PROP, RDTState, rmids, 256),
> +    DEFINE_PROP_END_OF_LIST(),

You'll see this in a rebase but this terminator is no longer needed
(or defined I think)
> +};
> +
> +static void rdt_init(Object *obj)
> +{
> +}
> +
> +static void rdt_finalize(Object *obj)
> +{
> +}

Why introduce this pair as empty and as far as I can see not called?
init is called in patch 2 so bring it in there.  I'm struggling to
spot finalize being called.


> +
> +static void rdt_class_init(ObjectClass *klass, void *data)
> +{
> +    DeviceClass *dc = DEVICE_CLASS(klass);
> +
> +    dc->hotpluggable = false;
> +    dc->desc = "RDT";
> +    dc->user_creatable = true;
> +
> +    device_class_set_props(dc, rdt_properties);
> +}

>      int32_t node_id; /* NUMA node this CPU belongs to */



  reply	other threads:[~2025-02-20 15:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-13 17:26 [PATCH v5 0/8] mulate Intel RDT features needed to mount ResCtrl in Linux Hendrik Wuethrich
2024-12-13 17:26 ` [PATCH v5 1/8] i386: Add Intel RDT device and State to config Hendrik Wuethrich
2025-02-20 15:41   ` Jonathan Cameron via [this message]
2025-02-28  8:40     ` Hendrik Wüthrich
2024-12-13 17:26 ` [PATCH v5 2/8] i386: Add init and realize functionality for RDT device Hendrik Wuethrich
2024-12-13 17:26 ` [PATCH v5 3/8] i386: Add RDT functionality Hendrik Wuethrich
2024-12-13 17:26 ` [PATCH v5 4/8] i386: Add RDT device interface through MSRs Hendrik Wuethrich
2024-12-13 17:26 ` [PATCH v5 5/8] i386: Add CPUID enumeration for RDT Hendrik Wuethrich
2024-12-13 17:26 ` [PATCH v5 6/8] i386: Add RDT feature flags Hendrik Wuethrich
2025-01-08 18:39   ` Michael S. Tsirkin
2025-01-15 14:55     ` Hendrik Wüthrich
2024-12-13 17:26 ` [PATCH v5 7/8] i386/cpu: Adjust CPUID level for RDT features Hendrik Wuethrich
2024-12-13 17:26 ` [PATCH v5 8/8] i386/cpu: Adjust level for RDT on full_cpuid_auto_level Hendrik Wuethrich
2025-01-08 18:35   ` Michael S. Tsirkin
2025-02-20 14:50 ` [PATCH v5 0/8] mulate Intel RDT features needed to mount ResCtrl in Linux Michael S. Tsirkin
2025-02-20 15:38   ` Hendrik Wüthrich

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=20250220154125.00007a08@huawei.com \
    --to=qemu-devel@nongnu.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=eduardo@habkost.net \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peternewman@google.com \
    --cc=richard.henderson@linaro.org \
    --cc=whendrik@google.com \
    --cc=xiaoyao.li@intel.com \
    --cc=zhao1.liu@intel.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 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.