From owner-freebsd-arm@freebsd.org Wed Apr 21 04:34:54 2021 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1378C5F5DF7 for ; Wed, 21 Apr 2021 04:34:54 +0000 (UTC) (envelope-from freebsd-arm@darkain.com) Received: from MTA-12-4.privateemail.com (mta-12-4.privateemail.com [198.54.127.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQ74s2Ptnz4bdh; Wed, 21 Apr 2021 04:34:52 +0000 (UTC) (envelope-from freebsd-arm@darkain.com) Received: from mta-12.privateemail.com (localhost [127.0.0.1]) by mta-12.privateemail.com (Postfix) with ESMTP id 5D06980083; Wed, 21 Apr 2021 00:34:51 -0400 (EDT) Received: from mail-lj1-f182.google.com (unknown [10.20.151.243]) by mta-12.privateemail.com (Postfix) with ESMTPA id B0CF38007E; Wed, 21 Apr 2021 00:34:50 -0400 (EDT) Received: by mail-lj1-f182.google.com with SMTP id a5so9191372ljk.0; Tue, 20 Apr 2021 21:34:50 -0700 (PDT) X-Gm-Message-State: AOAM532BrAJaUkD2bSoXfqXdMnz9OcrxKxB9QBLplit2LwxByMclZaac aBDYRu85dsHfnYEqHPVWG+bGhR16pyhQv4HrSAY= X-Google-Smtp-Source: ABdhPJynovTqHmMUBmE+vU/1/UxL97C/aYQ+h1QSwE+XLjHmJhr3Hb/nyCr44m/o+E5zCxvzMmtX4+kDJCMLEZYk7xE= X-Received: by 2002:a05:651c:1306:: with SMTP id u6mr17853576lja.197.1618979689057; Tue, 20 Apr 2021 21:34:49 -0700 (PDT) MIME-Version: 1.0 References: <2B7A227B-245F-4F1B-A700-263C3FE56B68@freebsd.org> <13A8B0FE-6300-4980-8DA9-49C7A37840CC@unrelenting.technology> In-Reply-To: From: Vincent Milum Jr Date: Tue, 20 Apr 2021 21:34:27 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: gic-v2 and SGI interrupts on boot CPU To: Greg V Cc: freebsd-arm@freebsd.org, Michael Tuexen , Dmitry Skorodumov X-Virus-Scanned: ClamAV using ClamSMTP X-Rspamd-Queue-Id: 4FQ74s2Ptnz4bdh X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd-arm@darkain.com designates 198.54.127.107 as permitted sender) smtp.mailfrom=freebsd-arm@darkain.com X-Spamd-Result: default: False [-3.28 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:198.54.127.96/27]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; DMARC_NA(0.00)[darkain.com]; RWL_MAILSPIKE_VERYGOOD(0.00)[198.54.127.107:from]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.977]; RCVD_IN_DNSWL_NONE(0.00)[198.54.127.107:from]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:22612, ipnet:198.54.127.0/24, country:US]; RCVD_TLS_LAST(0.00)[]; MAILMAN_DEST(0.00)[freebsd-arm] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Porting FreeBSD to ARM processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 04:34:54 -0000 Doing some more digging, I came across this post from a while ago. https://reviews.freebsd.org/D26975 I just built a kernel with this patch, and am now running 8 vCPUs under Parallels on my MacBook Air M1. You can see evidence of it here! https://twitter.com/DarkainMX/status/1384724684902600706 On Tue, Apr 20, 2021 at 7:59 PM Vincent Milum Jr wrote: > This may actually be related to the Parallels issue. We had a similar > issue with ESXi ARM Fling initially where it would only work on 1 vCPU but > not more, and it was related to the GIC code. This very much is worth > investigating for getting FreeBSD functional under Parallels! > > Oh, and yes, I've bothered Parallels a lot... I unofficially got a reply > essentially stating that the bug "isn't a priority" (they primarily care > about Windows VMs and seems to only marginally care about Linux, with > FreeBSD and other OSes not even remotely in their sights) > > On Tue, Apr 20, 2021 at 5:40 PM Greg V > wrote: > >> >> >> On April 20, 2021 10:38:44 PM UTC, Michael Tuexen >> wrote: >> >> On 21. Apr 2021, at 00:02, Dmitry Skorodumov via freebsd-arm < >> freebsd-arm@freebsd.org> wrote: >> >> >> >> Hi >> >> >> >> >> >> It looks like code for gic-v2 in FreeBSD not quite correctly relies on >> implementation defined behaviour of GIC. >> >> >> >> The >> gic >> 2.0 spec https://developer.arm.com/documentation/ihi0048/bb chapter >> 3.2.2 "Interrupt controls in the GIC" states the following: >> >> >> >> "Whether SGIs are permanently enabled, or can be enabled and disabled >> by writes to the GICD_ISENABLERn and GICD_ICENABLERn, is IMPLEMENTATION >> DEFINED." >> >> >> >> But code in sys/arm/arm/gic.c assumes that SGI are always enabled and >> doesn't configure them at initialization. They are initialized only for >> secondary CPUs - in arm_gic_init_secondary(). >> >> >> >> For sure it is a rather minor issue, since all appears to be ok in >> gic-v3 (v3 code enables SGIs for all CPUs, including the boot one). And >> even if platform supports only gic-v2, likely SGIs are always enabled >> anyway. So, my post is rather pedantic notice without real life case. >> >Dear all, >> > >> >if I understand things correctly, the problem described is the cause >> which does not >> >allow to use more than one CPU core in FreeBSD when running on Parallels >> Desktop on >> >an M1 based Mac. It runs perfectly well with one core, but with multiple >> cores it >> >locks up during boot. >> >> Hmm if I'm reading it correctly, the gicv2 driver *does* do this on >> secondary CPUs, just not on the boot one. Which doesn't sound like >> something that would cause SMP boot to break but single-core to still work. >> >> Seems like people using QEMU with Hypervisor.framework patches do have >> SMP working fine: >> https://gist.github.com/ctsrc/a1f57933a2cde9abc0f07be12889f97f so go >> bother Parallels about their bugs ;) >> _______________________________________________ >> freebsd-arm@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/freebsd-arm >> To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org" >> >