From patchwork Tue Mar 12 08:22:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 779690 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1907410wrt; Tue, 12 Mar 2024 01:25:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVPQc/eEqEg2ta5+EkfBAen6xI+lY2ch1nPbQajQsbv714NZ9xxd5fxyxHVkFR2hwl7qBi07tVkhNBb0Zr0SiW5 X-Google-Smtp-Source: AGHT+IFpzO6aul+EDOk+mkqe2SV/1wV857tLTbYRt0s08GcXEJobn2PUAjWChjFrWWKQ3RjmsvBb X-Received: by 2002:ac8:5f49:0:b0:42e:f031:f2a0 with SMTP id y9-20020ac85f49000000b0042ef031f2a0mr10648558qta.14.1710231931841; Tue, 12 Mar 2024 01:25:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710231931; cv=none; d=google.com; s=arc-20160816; b=L9DM+/kgFOE0A9NT5bmFRl+cjEyXKpA7Yeyqe2RSVsDr6nMJZ+pRibqwfMdp3j8SH6 rJqxl7NUWjKxmQLEMCkHramdvDLtdbrrxrQSz06CjURcVD5VIf4Urj7Gh5f5LFU85Vz4 bDuijiPEXFztT0G51TlOMQA/QnPNrpWzNIzl6s6K8rWESaPCbRZJ9tZslURVuKqhCZKz Za5T8n1Lb4zZx/QiHyoHpCYRZHVefSEPUjwmxtgVDF7kK1quiRVgQJ41+byi/9WMcVql NzhxVDuBUT8IPrPuA1TpjQnlFwxr7c++BdP1oBIFpHuiRv12oOvpxk2k5TFub3MRTYzR 1Nvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Eq8dPdS4O29YZHMSjUomBAXNnVOWg/nPlLYlOBRYYnw=; fh=/OjMTd8ii5kKJ/oyG1ORwNy4xKO7ElcessVTlN1EkRg=; b=nLoH/tBIcNJDR02oPfWNEVLATLa2NZdNyHMOrQ2MwyGN7Ta6GsbKjGHSj1zR7ShXKN d7xhNST9a21yyF+fxPbJy6lopyyVlV1qL7Ofz+PkgJbrUgHBdAm8C8Vf0RvXTANt29y4 tCz3d/PvH7/q/u+PQk6yHfXX3B0Yf8ra3D5iiO+kWa2tpD4VCpyx0SN/fxIPSuXWxeQL wF7iEOq4EGHTZY9PoBpIPI6qJ7pdmLfIgF6IbpDzcTjWmxM2LKiGZXy7DccTYsaiCdeR IOmGW3tlvdzH66yu58t3Vp267PkiOxgxoTsqdK2iBHuIrV4I3BWqjhdOHxS1CcDfozv4 nhNQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TcVF8q6C; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u2-20020ac858c2000000b0042f3074099esi7249759qta.495.2024.03.12.01.25.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 01:25:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TcVF8q6C; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjxQ6-000668-5H; Tue, 12 Mar 2024 04:23:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rjxQ4-00062O-1V for qemu-devel@nongnu.org; Tue, 12 Mar 2024 04:23:32 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjxQ1-0001CV-4x for qemu-devel@nongnu.org; Tue, 12 Mar 2024 04:23:31 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-33e8b957a89so1580176f8f.0 for ; Tue, 12 Mar 2024 01:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710231807; x=1710836607; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Eq8dPdS4O29YZHMSjUomBAXNnVOWg/nPlLYlOBRYYnw=; b=TcVF8q6CVfURTxPJpFVhmfBYNF3AcQyeUARzttJCWT6au5QoD2EK4TnbjV0DAz4o17 V2eVZZwVvivJNj2qn8Fut3l8cG35tFybALy4IgnxM+i5j9cmcaThLrikdrx5u/bGFEsP dfnIak911LM0Ygi8aU2nXkIfD/fB6pepAczg6oFsMmypp2mrwT8ujsd4w+T+qm7kt4ze u7U/ZdsL03pUFhL0Vk8Gfq/wsN8/GzUmvjqk9jeS76n5n8gZDrbWpuBmDcs1++JKZJt6 WhoNMP+TaIWlpIXSRl0y6UL4cFjW7rE1WrKvpldJd+5PP1PFjGpt8/OEf0r+GTBsvZOq gt9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710231807; x=1710836607; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Eq8dPdS4O29YZHMSjUomBAXNnVOWg/nPlLYlOBRYYnw=; b=UiHK63kFY00iiB4Jl1N8ztOdIbqtDA9p/9A4lwSTnsRFijLiEw9CAlh0Y/hTlLhtQ2 yBFlD7wNRhYyNAQPzBHOZmU5sRolLCC4UVgmPb61EWzMEOz5GFckpWOX04ZKjrAdymil ikA9xmgDMS+mwfnJJL1EUZWtJNmTMHRH4HprUmaxGycbp0kmOreb2SyQTiInADtVSdI0 q0NVAKmK44Hispf8qKtvraM2y5w4wODNQwnwK8TqBSHwA1ckL0fCg67lWAannUs3ZdKp x1jH0gpeFUsRqxMybleAPzMjcMHcI958ViO3CYhaVUi/Ec3lKJnOtk6tkM1PeJEidO68 NdAg== X-Gm-Message-State: AOJu0YxeiThGYuco1Sfb85RtPWreD8a/Jq+mCaSpLtKaKY2tGYGkwbbO tpy3VesdQljrZvO9iOWwwzOYs4w1CdGs/n3kybzSiqNTTl0uOEeCt0DYuWAAaWDQj1ujWyYUGlp A X-Received: by 2002:a5d:5505:0:b0:33d:277d:a2c7 with SMTP id b5-20020a5d5505000000b0033d277da2c7mr5082955wrv.16.1710231807243; Tue, 12 Mar 2024 01:23:27 -0700 (PDT) Received: from m1x-phil.lan ([176.187.206.139]) by smtp.gmail.com with ESMTPSA id bx33-20020a5d5b21000000b0033e93e00f68sm5279431wrb.61.2024.03.12.01.23.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Mar 2024 01:23:26 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-block@nongnu.org, Mark Cave-Ayland , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Artyom Tarasenko Subject: [PULL 07/13] sun4u: remap ebus BAR0 to use unassigned_io_ops instead of alias to PCI IO space Date: Tue, 12 Mar 2024 09:22:32 +0100 Message-ID: <20240312082239.69696-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240312082239.69696-1-philmd@linaro.org> References: <20240312082239.69696-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Mark Cave-Ayland During kernel startup OpenBSD accesses addresses mapped by BAR0 of the ebus device but at offsets where no IO devices exist. Before commit 4aa07e8649 ("hw/sparc64/ebus: Access memory regions via pci_address_space_io()") BAR0 was mapped to legacy IO space which allows accesses to unmapped devices to succeed, but afterwards these accesses to unmapped PCI IO space cause a memory fault which prevents OpenBSD from booting. Since no devices are mapped at the addresses accessed by OpenBSD, change ebus BAR0 from a PCI IO space alias to an IO memory region using unassigned_io_ops which allows these accesses to succeed and so allows OpenBSD to boot once again. Fixes: 4aa07e8649 ("hw/sparc64/ebus: Access memory regions via pci_address_space_io()") Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240311064345.2531197-1-mark.cave-ayland@ilande.co.uk> Signed-off-by: Philippe Mathieu-Daudé --- hw/sparc64/sun4u.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index eda9b58a21..cff6d5abaf 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -360,8 +360,13 @@ static void ebus_realize(PCIDevice *pci_dev, Error **errp) pci_dev->config[0x09] = 0x00; // programming i/f pci_dev->config[0x0D] = 0x0a; // latency_timer - memory_region_init_alias(&s->bar0, OBJECT(s), "bar0", - pci_address_space_io(pci_dev), 0, 0x1000000); + /* + * BAR0 is accessed by OpenBSD but not for ebus device access: allow any + * memory access to this region to succeed which allows the OpenBSD kernel + * to boot. + */ + memory_region_init_io(&s->bar0, OBJECT(s), &unassigned_io_ops, s, + "bar0", 0x1000000); pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar0); memory_region_init_alias(&s->bar1, OBJECT(s), "bar1", pci_address_space_io(pci_dev), 0, 0x8000);