public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Yury Norov <ynorov@nvidia.com>
Cc: "Thomas Gleixner" <tglx@kernel.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Andy Lutomirski" <luto@kernel.org>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Johannes Berg" <johannes@sipsolutions.net>,
	"David Laight" <david.laight.linux@gmail.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Ping-Ke Shih" <pkshih@realtek.com>,
	"Richard Cochran" <richardcochran@gmail.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Yury Norov" <yury.norov@gmail.com>,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"Hans de Goede" <hansg@kernel.org>,
	"Linus Walleij" <linusw@kernel.org>,
	"Sakari Ailus" <sakari.ailus@linux.intel.com>,
	"Salah Triki" <salah.triki@gmail.com>,
	"Achim Gratz" <Achim.Gratz@stromeko.de>,
	"Ben Collins" <bcollins@watter.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	linux-iio@vger.kernel.org, linux-wireless@vger.kernel.org,
	netdev@vger.kernel.org, linux-rtc@vger.kernel.org
Subject: Re: [PATCH v2 2/9] x86/extable: switch to using FIELD_GET_SIGNED()
Date: Tue, 28 Apr 2026 11:39:05 +0200	[thread overview]
Message-ID: <20260428093905.GA1026330@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20260427214127.406067-3-ynorov@nvidia.com>

On Mon, Apr 27, 2026 at 05:41:19PM -0400, Yury Norov wrote:
> The EX_DATA register is laid out such that EX_DATA_IMM occupied MSB.
> It's done to make sure that FIELD_GET() will sign-extend the IMM
> field during extraction.
> 
> To enforce that, all EX_DATA masks are made signed integers. This
> works, but relies on the particular implementation of FIELD_GET(),
> i.e. masking then shifting, not vice versa; and the particular
> placement of the fields in the register.
> 
> Switch to using the dedicated FIELD_GET_SIGNED(), and relax those
> limitations.
> 
> Signed-off-by: Yury Norov <ynorov@nvidia.com>

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

> ---
>  arch/x86/include/asm/extable_fixup_types.h | 13 ++++---------
>  arch/x86/mm/extable.c                      |  2 +-
>  2 files changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/x86/include/asm/extable_fixup_types.h b/arch/x86/include/asm/extable_fixup_types.h
> index 906b0d5541e8..fd0cfb472103 100644
> --- a/arch/x86/include/asm/extable_fixup_types.h
> +++ b/arch/x86/include/asm/extable_fixup_types.h
> @@ -2,15 +2,10 @@
>  #ifndef _ASM_X86_EXTABLE_FIXUP_TYPES_H
>  #define _ASM_X86_EXTABLE_FIXUP_TYPES_H
>  
> -/*
> - * Our IMM is signed, as such it must live at the top end of the word. Also,
> - * since C99 hex constants are of ambiguous type, force cast the mask to 'int'
> - * so that FIELD_GET() will DTRT and sign extend the value when it extracts it.
> - */
> -#define EX_DATA_TYPE_MASK		((int)0x000000FF)
> -#define EX_DATA_REG_MASK		((int)0x00000F00)
> -#define EX_DATA_FLAG_MASK		((int)0x0000F000)
> -#define EX_DATA_IMM_MASK		((int)0xFFFF0000)
> +#define EX_DATA_TYPE_MASK		(0x000000FF)
> +#define EX_DATA_REG_MASK		(0x00000F00)
> +#define EX_DATA_FLAG_MASK		(0x0000F000)
> +#define EX_DATA_IMM_MASK		(0xFFFF0000)
>  
>  #define EX_DATA_REG_SHIFT		8
>  #define EX_DATA_FLAG_SHIFT		12
> diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c
> index 6b9ff1c6cafa..ceb8d03191ab 100644
> --- a/arch/x86/mm/extable.c
> +++ b/arch/x86/mm/extable.c
> @@ -322,7 +322,7 @@ int fixup_exception(struct pt_regs *regs, int trapnr, unsigned long error_code,
>  
>  	type = FIELD_GET(EX_DATA_TYPE_MASK, e->data);
>  	reg  = FIELD_GET(EX_DATA_REG_MASK,  e->data);
> -	imm  = FIELD_GET(EX_DATA_IMM_MASK,  e->data);
> +	imm  = FIELD_GET_SIGNED(EX_DATA_IMM_MASK, e->data);
>  
>  	switch (type) {
>  	case EX_TYPE_DEFAULT:
> -- 
> 2.51.0
> 

  reply	other threads:[~2026-04-28  9:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27 21:41 [PATCH v2 0/9] bitfield: add FIELD_GET_SIGNED() Yury Norov
2026-04-27 21:41 ` [PATCH v2 1/9] " Yury Norov
2026-04-27 21:41 ` [PATCH v2 2/9] x86/extable: switch to using FIELD_GET_SIGNED() Yury Norov
2026-04-28  9:39   ` Peter Zijlstra [this message]
2026-04-27 21:41 ` [PATCH v2 3/9] iio: intel_dc_ti_adc: " Yury Norov
2026-04-27 21:41 ` [PATCH v2 4/9] iio: magnetometer: yas530: " Yury Norov
2026-04-27 21:41 ` [PATCH v2 5/9] iio: pressure: bmp280: " Yury Norov
2026-04-27 21:41 ` [PATCH v2 6/9] iio: mcp9600: " Yury Norov
2026-04-27 21:41 ` [PATCH v2 7/9] wifi: rtw89: " Yury Norov
2026-04-28  7:10   ` Andy Shevchenko
2026-04-28 10:43     ` David Laight
2026-04-27 21:41 ` [PATCH v2 8/9] rtc: rv3032: " Yury Norov
2026-04-28 14:20   ` Alexandre Belloni
2026-04-27 21:41 ` [PATCH v2 9/9] ptp: " Yury Norov

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=20260428093905.GA1026330@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=Achim.Gratz@stromeko.de \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andy@kernel.org \
    --cc=bcollins@watter.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=david.laight.linux@gmail.com \
    --cc=dlechner@baylibre.com \
    --cc=edumazet@google.com \
    --cc=hansg@kernel.org \
    --cc=hpa@zytor.com \
    --cc=jic23@kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=pabeni@redhat.com \
    --cc=pkshih@realtek.com \
    --cc=richardcochran@gmail.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=salah.triki@gmail.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    --cc=ynorov@nvidia.com \
    --cc=yury.norov@gmail.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