All of lore.kernel.org
 help / color / mirror / Atom feed
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] hvc_dcc: disable user-space access to DCC
Date: Wed, 01 Jul 2015 17:00:28 -0700	[thread overview]
Message-ID: <55947F1C.3020904@codeaurora.org> (raw)
In-Reply-To: <1435699387-32591-4-git-send-email-timur@codeaurora.org>

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

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd@codeaurora.org>
To: Timur Tabi <timur@codeaurora.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Shanker Donthineni <shankerd@codeaurora.org>,
	awallis@codeaurora.org, abhimany@codeaurora.org,
	will.deacon@arm.com, Vipul Gandhi <vgandhi@codeaurora.org>
Subject: Re: [PATCH 4/4] hvc_dcc: disable user-space access to DCC
Date: Wed, 01 Jul 2015 17:00:28 -0700	[thread overview]
Message-ID: <55947F1C.3020904@codeaurora.org> (raw)
In-Reply-To: <1435699387-32591-4-git-send-email-timur@codeaurora.org>

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


  reply	other threads:[~2015-07-02  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 21:23 [PATCH 1/4] hvc_dcc: bind driver to core0 for reads and writes Timur Tabi
2015-06-30 21:23 ` Timur Tabi
2015-06-30 21:23 ` [PATCH 2/4] hvc_dcc: don't ignore errors during initialization Timur Tabi
2015-06-30 21:23   ` Timur Tabi
2015-07-01 23:54   ` Stephen Boyd
2015-07-01 23:54     ` Stephen Boyd
2015-07-03 14:46     ` Timur Tabi
2015-07-03 14:46       ` Timur Tabi
2015-06-30 21:23 ` [PATCH 3/4] [v3] ARM64: TTY: hvc_dcc: Add support for ARM64 dcc Timur Tabi
2015-06-30 21:23   ` Timur Tabi
2015-06-30 21:23 ` [PATCH 4/4] hvc_dcc: disable user-space access to DCC Timur Tabi
2015-06-30 21:23   ` Timur Tabi
2015-07-02  0:00   ` Stephen Boyd [this message]
2015-07-02  0:00     ` Stephen Boyd
2015-07-03 14:53     ` Timur Tabi
2015-07-03 14:53       ` Timur Tabi
2015-07-01  1:37 ` [PATCH 1/4] hvc_dcc: bind driver to core0 for reads and writes Stephen Boyd
2015-07-01  1:37   ` Stephen Boyd
2015-07-01  1:57   ` Timur Tabi
2015-07-01  1:57     ` Timur Tabi
2015-07-01 23:38     ` Stephen Boyd
2015-07-01 23:38       ` Stephen Boyd
2015-07-03 14:42       ` Timur Tabi
2015-07-03 14:42         ` Timur Tabi

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=55947F1C.3020904@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.