[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 4/6] xen/riscv: introduce trap_init()


  • To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 30 May 2023 17:44:10 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0HJTtS53KqXWzSsb6L/aY7JxQ7HTLL/nxzWH6d7AWRs=; b=PTcpgYVj90fu8Ydo45BjsHZbcDnoroWvZm4OXws+c8oH0HTOg8ub4B8QAPA5YIAat/kXCAN+C0CEhpCBufIGY2VfhLr9U0Ak9jsCiZ3+8QMvX8m2xHpCyUKpAycUX5lD36AgaM1vgu5uT7JJeXHEH5bNakHPwVmgSOciUrcKR5LlypgF+YvE56Zb3sTUWL3T9ZkfodVusDqaNwBMJ3UfBPYOKq+FC5UuOtvSzGEkSzrF+I3oY/eTDgtFLxq6/ldvh8G8fgrdmj/IdhcxAd5hqGEc9Bzobl6UZX2hfin0kB0zc+XFj0w9N2C3rGmbwxefHdQNXu0k3cicN/5aJ99Bhg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O/8dDXUFqNmG3c+B/e0RP5vNbAx5X55/T3TglKZ6ARj7CSh7L91CPzesbrTuDR17Zq83Ab4YjEUDNpCkU2ZH7zc2Ah8w3gR01zjYv9hvLjxeuPjBV6qnEf3QNSMI1Eme3EXlnC/HJBS2E2pEz+Mle8GxsMKDLYMAdMlzYptBsNFwSl4LXX09Tmn1L52cDgzdPubyFjwbkBnVhsgFwCB+mjo2sO/NpW843ITeSmqew1RoQyHNCb7fmeX5XNHiyMa12wxwHMQbFKq+h00Mfwo7LcqztzZxTQF1tvWh5k2JmX2/7sL7NE3dNajxxgKDeK0sUj1zGIYfnqceAg7xmCNrRQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Julien Grall <julien@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 30 May 2023 15:44:34 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 29.05.2023 14:13, Oleksii Kurochko wrote:
> --- a/xen/arch/riscv/traps.c
> +++ b/xen/arch/riscv/traps.c
> @@ -12,6 +12,31 @@
>  #include <asm/processor.h>
>  #include <asm/traps.h>
>  
> +#define cast_to_bug_frame(addr) \
> +    (const struct bug_frame *)(addr)

I can't find a use for this; should it be dropped or moved to some
later patch? In any event, if ti's intended to survive, it needs yet
another pair of parentheses.

> +/*
> + * Initialize the trap handling.
> + *
> + * The function is called after MMU is enabled.
> + */
> +void trap_init(void)

Is this going to be used for secondary processors as well? If not,
it will want to be __init.

> +{
> +    /*
> +     * When the MMU is off, addr varialbe will be a physical address 
> otherwise
> +     * it would be a virtual address.
> +     *
> +     * It will work fine as:
> +     *  - access to addr is PC-relative.
> +     *  - -nopie is used. -nopie really suppresses the compiler emitting
> +     *    code going through .got (which then indeed would mean using 
> absolute
> +     *    addresses).
> +     */

Is all of this comment still relevant not that you're running with
the MMU already enabled.

Jan

> +    unsigned long addr = (unsigned long)&handle_trap;
> +
> +    csr_write(CSR_STVEC, addr);
> +}
> +
>  static const char *decode_trap_cause(unsigned long cause)
>  {
>      static const char *const trap_causes[] = {




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.