diff mbox series

[for-4.19?,v5,09/10] xen/x86: Disallow creating domains with altp2m enabled and altp2m.nr == 0

Message ID d6fd97b66b5f1a974e317c9d3f72fb139b39118f.1717356829.git.w1benny@gmail.com (mailing list archive)
State Superseded
Headers show
Series x86: Make MAX_ALTP2M configurable | expand

Commit Message

Petr Beneš June 2, 2024, 8:04 p.m. UTC
From: Petr Beneš <w1benny@gmail.com>

Since libxl finally sends the altp2m.nr value, we can remove the previously
introduced temporary workaround.

Creating domain with enabled altp2m while setting altp2m.nr == 0 doesn't
make sense and it's probably not what user wants.

Signed-off-by: Petr Beneš <w1benny@gmail.com>
---
 xen/arch/x86/domain.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--
2.34.1

Comments

Jan Beulich June 6, 2024, 7:57 a.m. UTC | #1
On 02.06.2024 22:04, Petr Beneš wrote:
> From: Petr Beneš <w1benny@gmail.com>
> 
> Since libxl finally sends the altp2m.nr value, we can remove the previously
> introduced temporary workaround.
> 
> Creating domain with enabled altp2m while setting altp2m.nr == 0 doesn't
> make sense and it's probably not what user wants.

Yet: Do we need separate count and flag anymore? Can't "nr != 0"
take the place of the flag being true?

Jan
Petr Beneš June 8, 2024, 11:08 p.m. UTC | #2
The flag isn't bool. It can hold one of 3 values (besides 0).

P.

On Thu, Jun 6, 2024 at 9:57 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 02.06.2024 22:04, Petr Beneš wrote:
> > From: Petr Beneš <w1benny@gmail.com>
> >
> > Since libxl finally sends the altp2m.nr value, we can remove the previously
> > introduced temporary workaround.
> >
> > Creating domain with enabled altp2m while setting altp2m.nr == 0 doesn't
> > make sense and it's probably not what user wants.
>
> Yet: Do we need separate count and flag anymore? Can't "nr != 0"
> take the place of the flag being true?
>
> Jan
Jan Beulich June 10, 2024, 7:33 a.m. UTC | #3
On 09.06.2024 01:08, Petr Beneš wrote:
> The flag isn't bool. It can hold one of 3 values (besides 0).

Oh, sorry, yes.

Acked-by: Jan Beulich <jbeulich@suse.com>

Jan

> On Thu, Jun 6, 2024 at 9:57 AM Jan Beulich <jbeulich@suse.com> wrote:
>>
>> On 02.06.2024 22:04, Petr Beneš wrote:
>>> From: Petr Beneš <w1benny@gmail.com>
>>>
>>> Since libxl finally sends the altp2m.nr value, we can remove the previously
>>> introduced temporary workaround.
>>>
>>> Creating domain with enabled altp2m while setting altp2m.nr == 0 doesn't
>>> make sense and it's probably not what user wants.
>>
>> Yet: Do we need separate count and flag anymore? Can't "nr != 0"
>> take the place of the flag being true?
>>
>> Jan
diff mbox series

Patch

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 011cffb07e..52bfeafe3f 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -747,8 +747,9 @@  int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)

         if ( !config->altp2m.nr )
         {
-            /* Fix the value to the legacy default */
-            config->altp2m.nr = 10;
+            dprintk(XENLOG_INFO,
+                    "altp2m must be requested with altp2m.nr > 0\n");
+            return -EINVAL;
         }

         if ( config->altp2m.nr > MAX_NR_ALTP2M )