From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRt7Z-0004VH-LB for qemu-devel@nongnu.org; Wed, 10 Sep 2014 21:24:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XRt7Q-00020z-Bm for qemu-devel@nongnu.org; Wed, 10 Sep 2014 21:24:25 -0400 Received: from e23smtp03.au.ibm.com ([202.81.31.145]:39266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRt7P-000204-NA for qemu-devel@nongnu.org; Wed, 10 Sep 2014 21:24:16 -0400 Received: from /spool/local by e23smtp03.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 11 Sep 2014 11:24:08 +1000 Message-ID: <5410F9A8.3010401@au1.ibm.com> Date: Thu, 11 Sep 2014 11:23:52 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <20140904111153.20476.58429.stgit@aravindap> <20140904111344.20476.8330.stgit@aravindap> <54096EA8.30600@suse.de> <54097418.6040101@linux.vnet.ibm.com> In-Reply-To: <54097418.6040101@linux.vnet.ibm.com> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 3/4] target-ppc: Build error log List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aravinda Prasad , Alexander Graf Cc: benh@au1.ibm.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, paulus@samba.org On 09/05/2014 06:28 PM, Aravinda Prasad wrote: > > > On Friday 05 September 2014 01:34 PM, Alexander Graf wrote: >> >> >> On 04.09.14 13:13, Aravinda Prasad wrote: >>> Whenever there is a physical memory error due to bit >>> flips, which cannot be corrected by hardware, the error >>> is passed on to the kernel. If the memory address in >>> error belongs to guest address space then guest kernel >>> is responsible to take action. Hence the error is passed >>> on to guest via KVM by invoking 0x200 NMI vector. >>> >>> However, guest OS, as per PAPR, expects an error log >>> upon such error. This patch registers a new hcall >>> which is issued from 0x200 interrupt vector and builds >>> the error log, copies the error log to rtas space and >>> passes the address of the error log to guest >>> >>> Enhancement to KVM to perform above functionality is >>> already in upstream kernel. >>> >>> Signed-off-by: Aravinda Prasad >>> --- >>> hw/ppc/spapr_hcall.c | 154 ++++++++++++++++++++++++++++++++++++++++++++++++ >>> include/hw/ppc/spapr.h | 4 + >>> 2 files changed, 157 insertions(+), 1 deletion(-) >>> >>> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c >>> index 01650ba..c3aa448 100644 >>> --- a/hw/ppc/spapr_hcall.c >>> +++ b/hw/ppc/spapr_hcall.c >>> @@ -14,6 +14,88 @@ struct SPRSyncState { >>> target_ulong mask; >>> }; >>> >>> +/* Offset from rtas-base where error log is placed */ >>> +#define RTAS_ERROR_OFFSET (TARGET_PAGE_SIZE) >> >> You can't assume this. Please compute the value at the same place you >> compute the rtas-size. > > sure > > >> >>> + >>> +#define RTAS_ELOG_SEVERITY_SHIFT 0x5 >>> +#define RTAS_ELOG_DISPOSITION_SHIFT 0x3 >>> +#define RTAS_ELOG_INITIATOR_SHIFT 0x4 >>> + >>> +/* >>> + * Only required RTAS event severity, disposition, initiator >>> + * target and type are copied from arch/powerpc/include/asm/rtas.h >>> + */ >>> + >>> +/* RTAS event severity */ >>> +#define RTAS_SEVERITY_ERROR_SYNC 0x3 >>> + >>> +/* RTAS event disposition */ >>> +#define RTAS_DISP_NOT_RECOVERED 0x2 >>> + >>> +/* RTAS event initiator */ >>> +#define RTAS_INITIATOR_MEMORY 0x4 >>> + >>> +/* RTAS event target */ >>> +#define RTAS_TARGET_MEMORY 0x4 >>> + >>> +/* RTAS event type */ >>> +#define RTAS_TYPE_ECC_UNCORR 0x09 >>> + >>> +/* >>> + * Currently KVM only passes on the uncorrected machine >>> + * check memory error to guest. Other machine check errors >>> + * such as SLB multi-hit and TLB multi-hit are recovered >>> + * in KVM and are not passed on to guest. >>> + * >>> + * DSISR Bit for uncorrected machine check error. Based >>> + * on arch/powerpc/include/asm/mce.h >> >> Please don't include Linux code. This file is GPLv2+ licensed and I >> don't want to taint it as GPLv2 only just for the sake of mce. > > Hmm.. ok. In that case I should not copy rtas_error_log structure below > from kernel source as well. I double checked with Alex and since arch/powerpc/include/asm/mce.h is GPL2+ and spapr_hcall.c does not have a license so it is what QEMU's license is (which is also GPL2+), copying is fine here. -- Alexey Kardashevskiy IBM OzLabs, LTC Team e-mail: aik@au1.ibm.com notes: Alexey Kardashevskiy/Australia/IBM