Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 497E0C0044D for ; Mon, 16 Mar 2020 18:04:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 05F8B20409 for ; Mon, 16 Mar 2020 18:04:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 05F8B20409 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDu6E-0008G0-4A for qemu-devel@archiver.kernel.org; Mon, 16 Mar 2020 14:04:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54310) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDtYs-00062c-Fq for qemu-devel@nongnu.org; Mon, 16 Mar 2020 13:29:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDtYr-0005pk-1w for qemu-devel@nongnu.org; Mon, 16 Mar 2020 13:29:58 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:42952) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDtYq-0005cI-NV for qemu-devel@nongnu.org; Mon, 16 Mar 2020 13:29:56 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02GHMLgi119300 for ; Mon, 16 Mar 2020 13:29:55 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2yrubn2fwc-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 16 Mar 2020 13:29:55 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 16 Mar 2020 17:29:52 -0000 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 16 Mar 2020 17:29:49 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02GHSmCZ48562522 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Mar 2020 17:28:48 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EF3B24C044; Mon, 16 Mar 2020 17:29:48 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 79C5B4C040; Mon, 16 Mar 2020 17:29:47 +0000 (GMT) Received: from in.ibm.com (unknown [9.199.45.53]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 16 Mar 2020 17:29:47 +0000 (GMT) Date: Mon, 16 Mar 2020 22:59:45 +0530 From: Mahesh J Salgaonkar To: Nicholas Piggin Subject: Re: [PATCH v2 3/8] ppc/spapr: Add FWNMI System Reset state References: <20200316142613.121089-1-npiggin@gmail.com> <20200316142613.121089-4-npiggin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200316142613.121089-4-npiggin@gmail.com> X-TM-AS-GCONF: 00 x-cbid: 20031617-0020-0000-0000-000003B56862 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20031617-0021-0000-0000-0000220DC90D Message-Id: <20200316172945.fkh5cowdseomgd7g@in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.645 definitions=2020-03-16_07:2020-03-12, 2020-03-16 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 suspectscore=1 adultscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 impostorscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003160076 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 X-Mailman-Approved-At: Mon, 16 Mar 2020 13:49:15 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: mahesh@linux.vnet.ibm.com Cc: Aravinda Prasad , Alexey Kardashevskiy , qemu-devel@nongnu.org, Greg Kurz , Ganesh Goudar , qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 2020-03-17 00:26:08 Tue, Nicholas Piggin wrote: > The FWNMI option must deliver system reset interrupts to their > registered address, and there are a few constraints on the handler > addresses specified in PAPR. Add the system reset address state and > checks. > > Signed-off-by: Nicholas Piggin Looks good to me. Reviwed-by: Mahesh Salgaonkar Thanks, -Mahesh. > --- > hw/ppc/spapr.c | 2 ++ > hw/ppc/spapr_rtas.c | 14 +++++++++++++- > include/hw/ppc/spapr.h | 3 ++- > 3 files changed, 17 insertions(+), 2 deletions(-) > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index b03b26370d..5f93c49706 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -1704,6 +1704,7 @@ static void spapr_machine_reset(MachineState *machine) > > spapr->cas_reboot = false; > > + spapr->fwnmi_system_reset_addr = -1; > spapr->fwnmi_machine_check_addr = -1; > spapr->fwnmi_machine_check_interlock = -1; > > @@ -2023,6 +2024,7 @@ static const VMStateDescription vmstate_spapr_fwnmi = { > .needed = spapr_fwnmi_needed, > .pre_save = spapr_fwnmi_pre_save, > .fields = (VMStateField[]) { > + VMSTATE_UINT64(fwnmi_system_reset_addr, SpaprMachineState), > VMSTATE_UINT64(fwnmi_machine_check_addr, SpaprMachineState), > VMSTATE_INT32(fwnmi_machine_check_interlock, SpaprMachineState), > VMSTATE_END_OF_LIST() > diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c > index 0b8c481593..521e6b0b72 100644 > --- a/hw/ppc/spapr_rtas.c > +++ b/hw/ppc/spapr_rtas.c > @@ -414,6 +414,7 @@ static void rtas_ibm_nmi_register(PowerPCCPU *cpu, > uint32_t nret, target_ulong rets) > { > hwaddr rtas_addr; > + target_ulong sreset_addr, mce_addr; > > if (spapr_get_cap(spapr, SPAPR_CAP_FWNMI) == SPAPR_CAP_OFF) { > rtas_st(rets, 0, RTAS_OUT_NOT_SUPPORTED); > @@ -426,7 +427,18 @@ static void rtas_ibm_nmi_register(PowerPCCPU *cpu, > return; > } > > - spapr->fwnmi_machine_check_addr = rtas_ld(args, 1); > + sreset_addr = rtas_ld(args, 0); > + mce_addr = rtas_ld(args, 1); > + > + /* PAPR requires these are in the first 32M of memory and within RMA */ > + if (sreset_addr >= 32 * MiB || sreset_addr >= spapr->rma_size || > + mce_addr >= 32 * MiB || mce_addr >= spapr->rma_size) { > + rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); > + return; > + } > + > + spapr->fwnmi_system_reset_addr = sreset_addr; > + spapr->fwnmi_machine_check_addr = mce_addr; > > rtas_st(rets, 0, RTAS_OUT_SUCCESS); > } > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h > index 64b83402cb..42d64a0368 100644 > --- a/include/hw/ppc/spapr.h > +++ b/include/hw/ppc/spapr.h > @@ -194,9 +194,10 @@ struct SpaprMachineState { > > /* State related to FWNMI option */ > > - /* Machine Check Notification Routine address > + /* System Reset and Machine Check Notification Routine addresses > * registered by "ibm,nmi-register" RTAS call. > */ > + target_ulong fwnmi_system_reset_addr; > target_ulong fwnmi_machine_check_addr; > > /* Machine Check FWNMI synchronization, fwnmi_machine_check_interlock is > -- > 2.23.0 > > -- Mahesh J Salgaonkar