Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1175620

Re: [PATCH 4/4] hvc_dcc: disable user-space access to DCC

From Stephen Boyd <sboyd@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH 4/4] hvc_dcc: disable user-space access to DCC
Date 2015-07-02 02:10 +0200
Message-ID <pHAeJ-3Ll-1@gated-at.bofh.it> (permalink)
References <pHbgm-5xn-7@gated-at.bofh.it> <pHbgm-5xn-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 06/30/2015 02:23 PM, Timur Tabi wrote:
> diff --git a/arch/arm/include/asm/dcc.h b/arch/arm/include/asm/dcc.h
> index b74899d..c50056b 100644
> --- a/arch/arm/include/asm/dcc.h
> +++ b/arch/arm/include/asm/dcc.h
> @@ -9,8 +9,11 @@
>   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>   * GNU General Public License for more details.
>   */
> +#ifndef __ASM_DCC_H
> +#define __ASM_DCC_H
>  
>  #include <asm/barrier.h>
> +#include <asm/hardware/cp14.h>

That's new.

>  
>  static inline u32 __dcc_getstatus(void)
>  {
> @@ -39,3 +42,15 @@ static inline void __dcc_putchar(char c)
>  		: "r" (c));
>  	isb();
>  }
> +
> +static inline void __dcc_initialize(void)
> +{
> +	u32 val;
> +
> +	/* Disable user-space access to DCC */
> +	val = MRC14(0, c0, c1, 0);
> +	val |= 1 << 12; /* DSCR[Comms] */
> +	MCR14(val, 0, c0, c1, 0);
> +}

Nitpick: We do raw cp14 accesses for other functions in this file, so it
would be nice to be consistent throughout.

> +
> +#endif
> diff --git a/arch/arm64/include/asm/dcc.h b/arch/arm64/include/asm/dcc.h
> index fcb8d7d..7843e62 100644
> --- a/arch/arm64/include/asm/dcc.h
> +++ b/arch/arm64/include/asm/dcc.h
> @@ -49,4 +49,15 @@ static inline void __dcc_putchar(char c)
>  	isb();
>  }
>  
> +static inline void __dcc_initialize(void)
> +{
> +	u32 val;
> +
> +	/* Disable user-space access to DCC */
> +	asm ("mrs %0, mdscr_el1\n"

shouldn't this be volatile?

> +		"	orr %0, %0, #4096\n" /* Set the TDCC bit */

arm64 has some #defines in debug-monitors.h which we should probably
extend to have this bit as a #define too.

> +		"	msr mdscr_el1, %0\n"
> +		: "=r" (val));
> +}
> +
>  #endif
>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4/4] hvc_dcc: disable user-space access to DCC Timur Tabi <timur@codeaurora.org> - 2015-06-30 23:30 +0200
  Re: [PATCH 4/4] hvc_dcc: disable user-space access to DCC Stephen Boyd <sboyd@codeaurora.org> - 2015-07-02 02:10 +0200
    Re: [PATCH 4/4] hvc_dcc: disable user-space access to DCC Timur Tabi <timur@codeaurora.org> - 2015-07-03 17:00 +0200

csiph-web