All of lore.kernel.org
 help / color / mirror / Atom feed
From: Swetha Joshi <swethajoshi139@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Trivial <qemu-trivial@nongnu.org>,
	Dongjiu Geng <gengdongjiu1@gmail.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PATCH_V3] Adding ifdefs to call the respective routines only when their configs are enabled
Date: Tue, 25 May 2021 09:27:57 -0700	[thread overview]
Message-ID: <CALf2nm+LFqM2=vDs8=YfyxQSUT-0xxaCiVmcQzrKoOa+zaTtdg@mail.gmail.com> (raw)
In-Reply-To: <CAFEAcA8RbVafdjn2hkXifAPUF=wxZup20PqPcRpQ1ivtnWCxww@mail.gmail.com>

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

Hey Peter, Phil,

Yeah like Peter mentioned, when KVM is enabled and we don't want VIRT
enabled, there are a couple of routines that are being called from virt.h
and ghes.h, which is resulting in errors. I came up with this simple fix
but if you think there is a better solution to it I'll let you/ other
developers who own it decide and fix it because I don't have much
experience or visibility into what happens internally, my knowledge is
restricted to just using the configs.

Thank you for the feedback.

On Tue, May 25, 2021 at 2:05 AM Peter Maydell <peter.maydell@linaro.org>
wrote:

> On Tue, 25 May 2021 at 04:21, Richard Henderson
> <richard.henderson@linaro.org> wrote:
> >
> > On 5/24/21 7:58 PM, Swetha Joshi wrote:
> > > Signed-off-by: Swetha Joshi <swethajoshi139@gmail.com>
> > > ---
> > >   target/arm/kvm64.c | 12 ++++++++----
> > >   1 file changed, 8 insertions(+), 4 deletions(-)
> >
> > You're still missing the commit message.
> >
> > >
> > > diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
> > > index dff85f6db9..47a4d9d831 100644
> > > --- a/target/arm/kvm64.c
> > > +++ b/target/arm/kvm64.c
> > > @@ -1403,7 +1403,10 @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int
> code, void *addr)
> > >       hwaddr paddr;
> > >       Object *obj = qdev_get_machine();
> > >       VirtMachineState *vms = VIRT_MACHINE(obj);
> > > -    bool acpi_enabled = virt_is_acpi_enabled(vms);
> > > +    bool acpi_enabled = false;
> > > +#ifdef CONFIG_ARM_VIRT
> > > +    acpi_enabled = virt_is_acpi_enabled(vms);
> > > +#endif /* CONFIG_ARM_VIRT */
> > >
> > >       assert(code == BUS_MCEERR_AR || code == BUS_MCEERR_AO);
> > >
> > > @@ -1426,12 +1429,13 @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int
> code, void *addr)
> > >                */
> > >               if (code == BUS_MCEERR_AR) {
> > >                   kvm_cpu_synchronize_state(c);
> > > -                if (!acpi_ghes_record_errors(ACPI_HEST_SRC_ID_SEA,
> paddr)) {
> > > -                    kvm_inject_arm_sea(c);
> > > -                } else {
> > > +#ifdef CONFIG_ACPI_APEI
> > > +                if (acpi_ghes_record_errors(ACPI_HEST_SRC_ID_SEA,
> paddr)) {
> > >                       error_report("failed to record the error");
> > >                       abort();
> > >                   }
> > > +#endif /* CONFIG_ACPI_APEI */
> > > +                kvm_inject_arm_sea(c);
> > >               }
> >
> > Otherwise the actual patch looks ok.
>
> I feel like the underlying problem here is that we let a
> virt-board-specific
> bit of code slip into what should be generic Arm/KVM code here. We do
> need to know "does the board actually have an ACPI table we can record the
> memory error into", but that shouldn't be a specific query to virt board
> code. I think (but have not tested) that a nicer solution would look like:
>
> bool acpi_ghes_present(void)
> {
>     return object_resolve_path_type("", TYPE_ACPI_GED, NULL) != NULL;
> }
>
> in hw/acpi/ghes.c, and then using that function instead of
> virt_is_acpi_enabled().
>
> That avoids the CONFIG_ARM_VIRT specific reference and the need for ifdefs,
> and means that any future Arm board that wants to can support memory errors
> via ACPI tables by creating the ACPI_GED device and setting up the ACPI
> tables as virt does.
>
> (You will also need: a stub "return false" version in a new ghes-stub.c
> file,
> in an if_false clause in the meson.build line for ghes.c similar to the way
> ipmi.c/ipmi-stub.c are done; a prototype in include/hw/acpi/ghes.h with a
> doc-comment block documenting the function; possibly to add a stub for
> acpi_ghes_record_errors() in the new ghes-stub.c.)
>
> thanks
> -- PMM
>


-- 
Regards

Swetha Joshi.

[-- Attachment #2: Type: text/html, Size: 4931 bytes --]

  reply	other threads:[~2021-05-25 17:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25  2:58 [PATCH_V3] Adding ifdefs to call the respective routines only when their configs are enabled Swetha Joshi
2021-05-25  3:20 ` Richard Henderson
     [not found]   ` <CALf2nmKjSB0FN1ZotYjLKF+BBsWiwLPUDjkNeRgq1HkG4P=Aow@mail.gmail.com>
2021-05-25  4:14     ` Richard Henderson
2021-05-25  6:45   ` Philippe Mathieu-Daudé
2021-05-25  9:04   ` Peter Maydell
2021-05-25 16:27     ` Swetha Joshi [this message]
2021-05-25 17:15       ` Peter Maydell
2021-05-26 17:32         ` Swetha Joshi
2021-05-26 18:19           ` Peter Maydell
2021-05-28  7:08             ` Dongjiu Geng
2021-05-28 19:41               ` Swetha Joshi
2021-06-02 13:44                 ` Dongjiu Geng
2021-06-03 17:17                   ` Swetha Joshi
2021-06-03 17:22                 ` Peter Maydell
2021-06-03 17:30                   ` Swetha Joshi
2021-06-04  5:25                     ` Swetha Joshi
2021-06-04  9:03                       ` Peter Maydell
2021-06-04 15:06                         ` Swetha Joshi
2021-09-07 10:02                           ` Peter Maydell

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='CALf2nm+LFqM2=vDs8=YfyxQSUT-0xxaCiVmcQzrKoOa+zaTtdg@mail.gmail.com' \
    --to=swethajoshi139@gmail.com \
    --cc=gengdongjiu1@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=richard.henderson@linaro.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.