From nobody Wed Aug 25 08:34:58 2021 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B7E121789479 for ; Wed, 25 Aug 2021 08:37:10 +0000 (UTC) (envelope-from s199p.wa1k9r@gmail.com) Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GvfVF6TS2z3s0V for ; Wed, 25 Aug 2021 08:37:09 +0000 (UTC) (envelope-from s199p.wa1k9r@gmail.com) Received: by mail-io1-xd36.google.com with SMTP id b10so17741212ioq.9 for ; Wed, 25 Aug 2021 01:37:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=gZF2T7CMPXtD5r/iN8D4JEMwOGZThLphQ5OzOaD7n/A=; b=soc3St5agSRsJ9Xn0cbouQw+DsYziZCxkRoFxz4/pjbEppNSn862t6gI96crj/74gq KVEb3I/fEtt2/B6y97N5M3CvmO+vQJl8PTZ7SiTR5UmlBe7Q1A/3urBF2riNfnia2+GG mdtoHvOkiiiW9IO4OFNV3sqy8WR1lrJK/zksQqYutN39U+oIiHY2AB7QvEdzPUh4KCl9 pJ5+lkSMwi8XuOuvlL5x0xZJfwSRURQ85/XvXY4colsupw8obHTwyEjJ7heKKVb0NyN8 aSX7w7lQynG3Xi+BaA3Z6VoBa7kL2BoOMps0VMot+GGhpgxirrvd4J8EFIcdgHMnCgHV 4ZAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=gZF2T7CMPXtD5r/iN8D4JEMwOGZThLphQ5OzOaD7n/A=; b=s6SSiUAY5c4Nww5gP5NzvzQBUAbZnHfCJ96YdQXi/GAXOWDxtqsjralpk0HN+yvxj4 7oMRUatM13EmVhKBUBaXwGG1r7B/98Q3Xu2QI6FAAHDGUp+NNjN7BV0MlhrMGZyZzAtf gCj4x/OWOevmmaX63f0I2nvDP8/4vLu/73ZuFb2br6vDxViGj7ukh2Aoz9K+dG8h27ks PN+y3umWs4M7stowbjZhtmmQ38hG51jSh05fXbkKP/a0glkR2GzvlwruINcZO0/7Gtux TbKQcF7jlfN02y51V9pFWIUPoILuTTEbA3+iOwdsLrjEKqkiOoinXVoTT5s5tVrbpdv8 pyOg== X-Gm-Message-State: AOAM533pl3Um//U4A2YPKez3FLAYu1uZ+2tpJqGlhmNaG3R1HaWCfqTf HxWzZzIFeAE8VJ4refE3ZOtNQ8cODYSA4JGqyv2ei1eUE6k= X-Google-Smtp-Source: ABdhPJwojiTks74CXiDKC2AsR5GkpZ9mrwdCQWcm7wRBl1nIhfEvg8u8Iidp6hyCF6qJvfYvtS/z6qqMfHqzQ8BfvBc= X-Received: by 2002:a5e:d80c:: with SMTP id l12mr26607547iok.120.1629880629079; Wed, 25 Aug 2021 01:37:09 -0700 (PDT) List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org MIME-Version: 1.0 From: Sleep Walker Date: Wed, 25 Aug 2021 11:34:58 +0300 Message-ID: Subject: FreeBSD-13.0-CURRENT on Baikal-m(aarch64) SoC To: Free BSD Content-Type: multipart/alternative; boundary="000000000000ec35cd05ca5e2729" X-Rspamd-Queue-Id: 4GvfVF6TS2z3s0V X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=soc3St5a; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of s199pwa1k9r@gmail.com designates 2607:f8b0:4864:20::d36 as permitted sender) smtp.mailfrom=s199pwa1k9r@gmail.com X-Spamd-Result: default: False [0.00 / 15.00]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; RCPT_COUNT_ONE(0.00)[1]; MID_RHS_MATCH_FROMTLD(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::d36:from]; NEURAL_SPAM_SHORT(1.00)[1.000]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: Y --000000000000ec35cd05ca5e2729 Content-Type: text/plain; charset="UTF-8" Hi! I am trying to add support for the new SoC Baikal-M in FreeBSD. https://www.baikalelectronics.com/products/338/ https://www.cnx-software.com/2021/08/10/desktop-and-all-in-one-arm-linux-computers-launched-with-baikal-m-processor/ The system is already starting in multi-user mode, but only one core out of eight is detected. To find out the reason, I slightly changed the code by adding the output of the error code. sys/arm64/arm64/mp_machdep.c ------------------------------------------------------------------------------------------------------------------------- printf("Starting CPU %u (%lx)\n", cpuid, target_cpu); pa = pmap_extract(kernel_pmap, (vm_offset_t)mpentry); err = psci_cpu_on(target_cpu, pa, cpuid); if (err != PSCI_RETVAL_SUCCESS) { printf("Starting CPU %u (%lx) psci_cpu_on return (%d)\n", cpuid, target_cpu, err); /* * Panic here if INVARIANTS are enabled and PSCI failed to * start the requested CPU. psci_cpu_on() returns PSCI_MISSING * to indicate we are unable to use it to start the given CPU. */ KASSERT(err == PSCI_MISSING || (mp_quirks & MP_QUIRK_CPULIST) == MP_QUIRK_CPULIST, ("Failed to start CPU %u (%lx), error %d\n", cpuid, target_cpu, err)); pcpu_destroy(pcpup); kmem_free((vm_offset_t)dpcpu[cpuid - 1], DPCPU_SIZE); dpcpu[cpuid - 1] = NULL; kmem_free((vm_offset_t)bootstacks[cpuid], PAGE_SIZE); bootstacks[cpuid] = NULL; mp_ncpus--; return (false); } -------------------------------------------------------------------------------------------------------------------------- I got the following log --------------------------------- Starting CPU 1 (1) Starting psci_cpu_on(1, f22008c8, 1) Starting CPU 1 (1) psci_cpu_on return (-9) Starting CPU 1 (100) Starting psci_cpu_on(100, f22008c8, 1) Starting CPU 1 (100) psci_cpu_on return (-9) Starting CPU 1 (101) ...... ---------------------------------- This document describes return codes https://developer.arm.com/documentation/den0022/latest 5.2.2 Return error codes Table 6 defines the values for error codes used with PSCI functions. All errors are 32-bit signed integers. SUCCESS 0 NOT_SUPPORTED -1 INVALID_PARAMETERS -2 DENIED -3 ALREADY_ON -4 ON_PENDING -5 INTERNAL_FAILURE -6 NOT_PRESENT -7 DISABLED -8 INVALID_ADDRESS -9 But in kernel sources in the file sys/dev/psci/psci.h no definition of INVALID_ADDRESS !!!!! /* * PSCI return codes. */ #define PSCI_RETVAL_SUCCESS 0 #define PSCI_RETVAL_NOT_SUPPORTED -1 #define PSCI_RETVAL_INVALID_PARAMS -2 #define PSCI_RETVAL_DENIED -3 #define PSCI_RETVAL_ALREADY_ON -4 #define PSCI_RETVAL_ON_PENDING -5 #define PSCI_RETVAL_INTERNAL_FAILURE -6 #define PSCI_RETVAL_NOT_PRESENT -7 #define PSCI_RETVAL_DISABLED -8 That is, no one expected the return code -9 to appear. What do you think is the reason for this error? Maybe someone has already encountered this behavior psci_cpu_on ? The DT files say the following. psci { compatible = "arm,psci-1.0", "arm,psci-0.2"; method = "smc"; }; Full DT files can be viewed here https://personalbsd.org/download/baikal/dts/ The complete system startup log can be viewed here. https://dmesgd.nycbug.org/index.cgi?do=view&id=6236 --- Sergey Tyuryukanov. --000000000000ec35cd05ca5e2729--