lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e3080423-61b3-5999-96a4-c1b49dffe0e9@samsung.com>
Date:   Tue, 15 Sep 2020 16:06:44 +0200
From:   Marek Szyprowski <m.szyprowski@...sung.com>
To:     Marc Zyngier <maz@...nel.org>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Jason Cooper <jason@...edaemon.net>, kernel-team@...roid.com
Subject: Re: [PATCH 2/2] irqchip/gic: Cleanup Franken-GIC handling

On 15.09.2020 15:39, Marc Zyngier wrote:
> Now that we have a static key identifying Samsung's unique creation,
> let's replace the indirect call to compute the base addresses by
> a simple test on the static key.
>
> Faster, cheaper, negative diffstat.
>
> Signed-off-by: Marc Zyngier <maz@...nel.org>
Tested-by: Marek Szyprowski <m.szyprowski@...sung.com>
> ---
>   drivers/irqchip/irq-gic.c | 48 +++++++++------------------------------
>   1 file changed, 11 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
> index 84a2d2a1aab7..98743afdaea6 100644
> --- a/drivers/irqchip/irq-gic.c
> +++ b/drivers/irqchip/irq-gic.c
> @@ -83,9 +83,6 @@ struct gic_chip_data {
>   #endif
>   	struct irq_domain *domain;
>   	unsigned int gic_irqs;
> -#ifdef CONFIG_GIC_NON_BANKED
> -	void __iomem *(*get_base)(union gic_base *);
> -#endif
>   };
>   
>   #ifdef CONFIG_BL_SWITCHER
> @@ -125,32 +122,6 @@ static struct gic_chip_data gic_data[CONFIG_ARM_GIC_MAX_NR] __read_mostly;
>   static struct gic_kvm_info gic_v2_kvm_info;
>   
>   #ifdef CONFIG_GIC_NON_BANKED
> -static void __iomem *gic_get_percpu_base(union gic_base *base)
> -{
> -	return raw_cpu_read(*base->percpu_base);
> -}
> -
> -static void __iomem *gic_get_common_base(union gic_base *base)
> -{
> -	return base->common_base;
> -}
> -
> -static inline void __iomem *gic_data_dist_base(struct gic_chip_data *data)
> -{
> -	return data->get_base(&data->dist_base);
> -}
> -
> -static inline void __iomem *gic_data_cpu_base(struct gic_chip_data *data)
> -{
> -	return data->get_base(&data->cpu_base);
> -}
> -
> -static inline void gic_set_base_accessor(struct gic_chip_data *data,
> -					 void __iomem *(*f)(union gic_base *))
> -{
> -	data->get_base = f;
> -}
> -
>   static DEFINE_STATIC_KEY_FALSE(frankengic_key);
>   static DEFINE_PER_CPU(u32, sgi_intid);
>   
> @@ -173,10 +144,20 @@ static inline u32 get_sgi_intid(void)
>   {
>   	return this_cpu_read(sgi_intid);
>   }
> +
> +static inline void __iomem *__get_base(union gic_base *base)
> +{
> +	if (is_frankengic())
> +		return raw_cpu_read(*base->percpu_base);
> +
> +	return base->common_base;
> +}
> +
> +#define gic_data_dist_base(d)	__get_base(&(d)->dist_base)
> +#define gic_data_cpu_base(d)	__get_base(&(d)->cpu_base)
>   #else
>   #define gic_data_dist_base(d)	((d)->dist_base.common_base)
>   #define gic_data_cpu_base(d)	((d)->cpu_base.common_base)
> -#define gic_set_base_accessor(d, f)
>   #define enable_frankengic()	do { } while(0)
>   #define is_frankengic()		false
>   #define set_sgi_intid(i)	do { } while(0)
> @@ -741,11 +722,6 @@ static int gic_notifier(struct notifier_block *self, unsigned long cmd,	void *v)
>   	int i;
>   
>   	for (i = 0; i < CONFIG_ARM_GIC_MAX_NR; i++) {
> -#ifdef CONFIG_GIC_NON_BANKED
> -		/* Skip over unused GICs */
> -		if (!gic_data[i].get_base)
> -			continue;
> -#endif
>   		switch (cmd) {
>   		case CPU_PM_ENTER:
>   			gic_cpu_save(&gic_data[i]);
> @@ -1187,7 +1163,6 @@ static int gic_init_bases(struct gic_chip_data *gic,
>   		}
>   
>   		enable_frankengic();
> -		gic_set_base_accessor(gic, gic_get_percpu_base);
>   	} else {
>   		/* Normal, sane GIC... */
>   		WARN(gic->percpu_offset,
> @@ -1195,7 +1170,6 @@ static int gic_init_bases(struct gic_chip_data *gic,
>   		     gic->percpu_offset);
>   		gic->dist_base.common_base = gic->raw_dist_base;
>   		gic->cpu_base.common_base = gic->raw_cpu_base;
> -		gic_set_base_accessor(gic, gic_get_common_base);
>   	}
>   
>   	/*

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ