From: Pavan Kondeti <quic_pkondeti@quicinc.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Marc Zyngier <maz@kernel.org>,
Pavan Kondeti <quic_pkondeti@quicinc.com>,
Akhil P Oommen <quic_akhilpo@quicinc.com>,
Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>,
Konrad Dybcio <konradybcio@kernel.org>,
"Abhinav Kumar" <quic_abhinavk@quicinc.com>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Marijn Suijten <marijn.suijten@somainline.org>,
David Airlie <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
Elliot Berman <quic_eberman@quicinc.com>,
<linux-arm-msm@vger.kernel.org>,
<dri-devel@lists.freedesktop.org>,
<freedreno@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] drm/msm/a6xx: Skip gpu secure fw load in EL2 mode
Date: Fri, 13 Dec 2024 08:35:27 +0530 [thread overview]
Message-ID: <b71d89f9-fb72-405a-b5bf-a09a796561bb@quicinc.com> (raw)
In-Reply-To: <Z1q9rnzOlB9J5dXb@J2N7QTR9R3>
On Thu, Dec 12, 2024 at 10:40:46AM +0000, Mark Rutland wrote:
> On Thu, Dec 12, 2024 at 08:50:12AM +0000, Marc Zyngier wrote:
> > On Thu, 12 Dec 2024 05:31:00 +0000,
> > Pavan Kondeti <quic_pkondeti@quicinc.com> wrote:
> > >
> > > On Wed, Dec 11, 2024 at 10:40:02AM +0000, Marc Zyngier wrote:
> > > > On Wed, 11 Dec 2024 00:37:34 +0000,
> > > > Pavan Kondeti <quic_pkondeti@quicinc.com> wrote:
> > > > >
> > > > > On Tue, Dec 10, 2024 at 09:24:03PM +0000, Marc Zyngier wrote:
> > > > > > > +static int a6xx_switch_secure_mode(struct msm_gpu *gpu)
> > > > > > > +{
> > > > > > > + int ret;
> > > > > > > +
> > > > > > > +#ifdef CONFIG_ARM64
> > > > > > > + /*
> > > > > > > + * We can access SECVID_TRUST_CNTL register when kernel is booted in EL2 mode. So, use it
> > > > > > > + * to switch the secure mode to avoid the dependency on zap shader.
> > > > > > > + */
> > > > > > > + if (is_kernel_in_hyp_mode())
> > > > > > > + goto direct_switch;
> > > > > >
> > > > > > No, please. To check whether you are *booted* at EL2, you need to
> > > > > > check for is_hyp_available(). Whether the kernel runs at EL1 or EL2 is
> > > > > > none of the driver's business, really. This is still absolutely
> > > > > > disgusting from an abstraction perspective, but I guess we don't have
> > > > > > much choice here.
> > > > > >
> > > > >
> > > > > Thanks Marc. Any suggestions on how we can make is_hyp_mode_available()
> > > > > available for modules? Do you prefer exporting
> > > > > kvm_protected_mode_initialized and __boot_cpu_mode symbols directly or
> > > > > try something like [1]?
> > > >
> > > > Ideally, neither. These were bad ideas nine years ago, and they still
> > > > are. The least ugly hack I can come up with is the patch below, and
> > > > you'd write something like:
> > > >
> > > > if (cpus_have_cap(ARM64_HAS_EL2_OWNERSHIP))
> > > > blah();
> > > >
> > > > This is obviously completely untested.
> > > >
> > >
> > > I have tested your patch. It works as intended. Thanks Marc.
> >
> > Note that you will probably get some push-back from the arm64
> > maintainers on this front, because this is a fairly incomplete (and
> > fragile) solution.
> >
> > It would be much better if the discriminant came from the device tree.
> > After all, the hypervisor is fscking-up^W^Wchanging the programming
> > model of the GPU, and that should be reflected in the DT. Because for
> > all intent and purposes, this is not the same hardware anymore.
>
> FWIW I agree 100%, this should be described in DT.
>
> The cpucap doesn't describe the actual property we care about, and it
> cannot in general (e.g. for nested virt). I would strongly prefer to not
> have that as it's setting ourselves up for failure.
>
Thanks for the feedback. I understand that EL2 detection in kernel is
not going to cover cases like bare metal EL1, nested virtualization. We
plan to take the DT approach.
Thanks,
Pavan
next prev parent reply other threads:[~2024-12-13 3:05 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 8:19 [PATCH] drm/msm/a6xx: Skip gpu secure fw load in EL2 mode Akhil P Oommen
2024-12-09 15:03 ` Konrad Dybcio
2024-12-09 20:54 ` Akhil P Oommen
2024-12-09 19:54 ` Rob Clark
2024-12-09 20:52 ` Akhil P Oommen
2024-12-09 21:56 ` Rob Clark
2024-12-10 9:13 ` Akhil P Oommen
2024-12-11 1:13 ` Bjorn Andersson
2024-12-11 3:08 ` Akhil P Oommen
2024-12-11 3:43 ` Rob Clark
2024-12-11 7:36 ` Pavan Kondeti
2024-12-11 8:52 ` Dmitry Baryshkov
2024-12-11 8:59 ` Pavan Kondeti
2024-12-10 20:54 ` Elliot Berman
2024-12-11 3:09 ` Akhil P Oommen
2024-12-10 21:24 ` Marc Zyngier
2024-12-11 0:37 ` Pavan Kondeti
2024-12-11 10:40 ` Marc Zyngier
2024-12-12 5:31 ` Pavan Kondeti
2024-12-12 8:50 ` Marc Zyngier
2024-12-12 10:40 ` Mark Rutland
2024-12-13 3:05 ` Pavan Kondeti [this message]
2024-12-10 22:52 ` Connor Abbott
2024-12-11 0:40 ` Pavan Kondeti
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=b71d89f9-fb72-405a-b5bf-a09a796561bb@quicinc.com \
--to=quic_pkondeti@quicinc.com \
--cc=airlied@gmail.com \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=konradybcio@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=quic_abhinavk@quicinc.com \
--cc=quic_akhilpo@quicinc.com \
--cc=quic_eberman@quicinc.com \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
/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