From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 5E0CDC07E96 for ; Thu, 8 Jul 2021 22:23:49 +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 B48A9617ED for ; Thu, 8 Jul 2021 22:23:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B48A9617ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=eik.bme.hu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m1cQt-0004Cu-7j for qemu-devel@archiver.kernel.org; Thu, 08 Jul 2021 18:23:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1cPX-0003QL-4N; Thu, 08 Jul 2021 18:22:23 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:36446) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1cPT-0005hN-RG; Thu, 08 Jul 2021 18:22:22 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 0F1CF74570E; Fri, 9 Jul 2021 00:22:16 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id DBF3E74570D; Fri, 9 Jul 2021 00:22:15 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id DA730745708; Fri, 9 Jul 2021 00:22:15 +0200 (CEST) Date: Fri, 9 Jul 2021 00:22:15 +0200 (CEST) From: BALATON Zoltan To: David Gibson Subject: Re: [PATCH qemu v22] spapr: Implement Open Firmware client interface In-Reply-To: Message-ID: References: <20210625055155.2252896-1-aik@ozlabs.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Cc: Alexey Kardashevskiy , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Greg Kurz Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Thu, 8 Jul 2021, David Gibson wrote: > On Fri, Jun 25, 2021 at 03:51:55PM +1000, Alexey Kardashevskiy wrote: > [snip] >> diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c >> new file mode 100644 >> index 000000000000..a17fd9d2fe94 >> --- /dev/null >> +++ b/hw/ppc/vof.c > [snip] >> +static int path_offset(const void *fdt, const char *path) >> +{ >> + g_autofree char *p = NULL; >> + char *at; >> + >> + /* >> + * https://www.devicetree.org/open-firmware/bindings/ppc/release/ppc-2_1.html#HDR16 >> + * >> + * "Conversion from numeric representation to text representation shall use >> + * the lower case forms of the hexadecimal digits in the range a..f, >> + * suppressing leading zeros". > > Huh... that suggests that Zoltan's firmware which passes a caps hex > and expects it to work is doing the wrong thing. We still need to > accomodate it, though. It's Linux which passes both upper and lower case variants (and all that a few line apart in the same file). The Pegasos2 SmartFirmware displays these with upper case address parts but accepts both upper and lower case. Here's a device tree dump from the original board firmware: https://osdn.net/projects/qmiga/wiki/SubprojectPegasos2/attach/PegasosII_OFW-Tree.txt Apple's OpenFirmware seems to have lower case addresses: http://nandra.segv.jp/NetBSD/G4.dump-device-tree.txt but maybe it also accepts upper case? I can't try that now. This works for pegasos2 guests I've tried but maybe only because the only problematic query is /pci@80000000/ide@C,1. If something wanted to get /pci@C0000000/isa@C then that might fail but I think most devices are on /pci@80000000 so this problem is unlikely to happen. The most correct way would be to convert all parts between @ and / or \0 to lower case but either this or the changed version in v23 which does strrcht('@') works for the cases I have. > [snip] >> + >> +static void vof_instantiate_rtas(Error **errp) >> +{ >> + error_setg(errp, "The firmware should have instantiated RTAS"); > > Since this always fails... > >> +} >> + >> +static uint32_t vof_call_method(MachineState *ms, Vof *vof, uint32_t methodaddr, >> + uint32_t ihandle, uint32_t param1, >> + uint32_t param2, uint32_t param3, >> + uint32_t param4, uint32_t *ret2) >> +{ >> + uint32_t ret = -1; >> + char method[VOF_MAX_METHODLEN] = ""; >> + OfInstance *inst; >> + >> + if (!ihandle) { >> + goto trace_exit; >> + } >> + >> + inst = (OfInstance *)g_hash_table_lookup(vof->of_instances, >> + GINT_TO_POINTER(ihandle)); >> + if (!inst) { >> + goto trace_exit; >> + } >> + >> + if (readstr(methodaddr, method, sizeof(method))) { >> + goto trace_exit; >> + } >> + >> + if (strcmp(inst->path, "/") == 0) { >> + if (strcmp(method, "ibm,client-architecture-support") == 0) { >> + Object *vmo = object_dynamic_cast(OBJECT(ms), TYPE_VOF_MACHINE_IF); >> + >> + if (vmo) { >> + VofMachineIfClass *vmc = VOF_MACHINE_GET_CLASS(vmo); >> + >> + g_assert(vmc->client_architecture_support); >> + ret = vmc->client_architecture_support(ms, first_cpu, param1); >> + } >> + >> + *ret2 = 0; >> + } >> + } else if (strcmp(inst->path, "/rtas") == 0) { >> + if (strcmp(method, "instantiate-rtas") == 0) { > > ... why do you even need to handle it here? This message has helped to catch problem with instantiate-rtas so it's useful to have here even if normally it would not get here. I don't remember what was the problem, maybe too small rtas-size or similar but getting a message instead of crashing did point to the problem. Regards, BALATON Zoltan