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

Re: [PATCH v3 2/2] xen/ppc: Implement a basic exception handler


  • To: Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 26 Oct 2023 10:03:05 +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=msptUi6HYJ/aRRYoMs+pZIPQrCpy+XmWxF7UOq0j7vo=; b=n1yqrcJdgj65oqg5aNSJW6KMWcds6MBDCp/9xZI2th+JKLXd0aMu3e9EFec2ku0yVNsm0Ezfy1kyP3qgX83Xm/o70sTuKIQhByr45R3AH8uEq1+GPqrsfykMkfnewP1OJ+wHcGBsh1dPb6HJp7lxPlX85tSPSoOcTzWbwcLGuILTbeKFgrapGx2QTG12G3vSCAkYptPPhEj9o8eHduPSDlKblrBAoY8GDZuDVSi/feg1hNqv9cxkJ5WmdFmtIoNKJkmm+lAtfwMYIBWd64OcVBXrYj1MFL93ln/rNFh+ERku81lrDfqVi6OwEkFstW/Ib29/1zxb0k0OnwtKZPJJ3A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QEyGhS/6lFf7ZWu3dOs4aA+RREy7mgsm6E6Qmbm5dbo2S3iJIoHjVScJLfCCrv4kVeS9ER/NOdplEEdrFfFLT6+VTCtVWmGj3QA79d6TqywXgCsQ6UyYjTSFNEkSgpys1AtZ6h2nmLGt8SIlzIosEXfmZ4HABhjD8ugcl9ZE9hMRNqi3XnWQBWkYW+YSV4iZehtsV6wNDg1qQ9Rpp4Yyr1AlbcmOBQByfVLnFcd/ieuKfDvsx50sVLWnY9JS4XTNt4MjhvwbHT8kUy9CebOHC2yXJITTXuvUDRFOpf2TMKSa1Cz+ywAkerQAnMvo+7sVQtlhLLfGkEYcUD6Y1SuEsQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Timothy Pearson <tpearson@xxxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 26 Oct 2023 08:03:46 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26.10.2023 00:41, Shawn Anastasio wrote:
> Implement a basic exception handler that dumps the CPU state to the
> console, as well as the code required to set the correct exception
> vector table's base address in setup.c.
> 
> Signed-off-by: Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>

Despite me being unhappy about the disconnect of the constants
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
One further remark/suggestion though (happy to take care of while
committing):

> --- /dev/null
> +++ b/xen/arch/ppc/ppc64/exceptions-asm.S
> @@ -0,0 +1,135 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +
> +#include <asm/asm-defns.h>
> +#include <asm/processor.h>
> +
> +    .section .text.exceptions, "ax", %progbits
> +
> +    /* Helper to dump CPU state to struct cpu_user_regs pointed to by r1. */
> +ENTRY(exception_common)
> +    /*
> +     * Save GPRs 1-31. TODO: The value of %r1 has already been modified by 
> the
> +     * ISR, so the value we save isn't the exact value we had on entry.
> +     */
> +    SAVE_GPRS(1, 31, %r1)

Wouldn't this comment ...

> +    /* Save LR, CTR, CR */
> +    mflr    %r0
> +    std     %r0, UREGS_lr(%r1)
> +    mfctr   %r0
> +    std     %r0, UREGS_ctr(%r1)
> +    mfcr    %r0
> +    stw     %r0, UREGS_cr(%r1) /* 32-bit */
> +
> +    /* Save Exception Registers */
> +    mfsrr0  %r0
> +    std     %r0, UREGS_pc(%r1)
> +    mfsrr1  %r0
> +    std     %r0, UREGS_msr(%r1)
> +    mfdsisr %r0
> +    stw     %r0, UREGS_dsisr(%r1) /* 32-bit */
> +    mfdar   %r0
> +    std     %r0, UREGS_dar(%r1)
> +    li      %r0, -1 /* OS's SRR0/SRR1 have been clobbered */
> +    std     %r0, UREGS_srr0(%r1)
> +    std     %r0, UREGS_srr1(%r1)
> +
> +    /* Setup TOC and a stack frame then call C exception handler */
> +    mr      %r3, %r1
> +    bcl     20, 31, 1f
> +1:  mflr    %r12
> +    addis   %r2, %r12, .TOC.-1b@ha
> +    addi    %r2, %r2, .TOC.-1b@l
> +
> +    li      %r0, 0
> +    stdu    %r0, -STACK_FRAME_OVERHEAD(%r1)
> +    bl      exception_handler
> +
> +    .size exception_common, . - exception_common
> +    .type exception_common, %function
> +
> +    /* Same as exception_common, but for exceptions that set HSRR{0,1} */
> +ENTRY(h_exception_common)
> +    /* Save GPRs 1-31 */
> +    SAVE_GPRS(1, 31, %r1)

... better be repeated here?

Jan



 


Rackspace

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