From owner-freebsd-arm@FreeBSD.ORG Wed May 13 15:35:30 2015 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8C29DCF0 for ; Wed, 13 May 2015 15:35:30 +0000 (UTC) Received: from phabric-backend.isc.freebsd.org (phabric-backend.isc.freebsd.org [IPv6:2001:4f8:3:ffe0:406a:0:50:2]) (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 5E1581C20 for ; Wed, 13 May 2015 15:35:30 +0000 (UTC) Received: from phabric-backend.isc.freebsd.org (phabric-backend.isc.freebsd.org [127.0.1.5]) by phabric-backend.isc.freebsd.org (8.14.9/8.14.9) with ESMTP id t4DFZUmI067176 for ; Wed, 13 May 2015 15:35:30 GMT (envelope-from daemon-user@phabric-backend.isc.freebsd.org) Received: (from daemon-user@localhost) by phabric-backend.isc.freebsd.org (8.14.9/8.14.9/Submit) id t4DFZT4P067175; Wed, 13 May 2015 15:35:29 GMT (envelope-from daemon-user) Date: Wed, 13 May 2015 15:35:29 +0000 To: freebsd-arm@freebsd.org From: "zbb (Zbigniew Bodek)" Subject: [Differential] [Updated, 1, 030 lines] D2377: Introduce ARM GICv3 support Message-ID: X-Priority: 3 Thread-Topic: D2377: Introduce ARM GICv3 support X-Herald-Rules: <28>, <31>, <32>, <34>, <8> X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-Cc: X-Phabricator-Cc: X-Phabricator-Cc: X-Phabricator-Cc: X-Phabricator-Cc: In-Reply-To: References: Thread-Index: MjA1ZGZkZWI5MTE4ZDk2Nzk0YzAyZGRiMWRiIFVTb0E= Precedence: bulk X-Phabricator-Sent-This-Message: Yes X-Mail-Transport-Agent: MetaMTA X-Auto-Response-Suppress: All X-Phabricator-Mail-Tags: , , , MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="b1_ef7558bf87cdf32496a347c12801e0cd" X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2015 15:35:30 -0000 --b1_ef7558bf87cdf32496a347c12801e0cd Content-Type: text/plain; charset = "utf-8" Content-Transfer-Encoding: 8bit zbb updated this revision to Diff 5364. zbb added a comment. This revision now requires review to proceed. Some more fixes from previous comments + fixes after final testing on HW. CHANGES SINCE LAST UPDATE https://reviews.freebsd.org/D2377?vs=5343&id=5364 REVISION DETAIL https://reviews.freebsd.org/D2377 AFFECTED FILES sys/arm64/arm64/gic_v3.c sys/arm64/arm64/gic_v3_fdt.c sys/arm64/arm64/gic_v3_reg.h sys/arm64/arm64/gic_v3_var.h sys/arm64/arm64/locore.S sys/arm64/include/armreg.h sys/conf/files.arm64 EMAIL PREFERENCES https://reviews.freebsd.org/settings/panel/emailpreferences/ To: zbb, ian, imp, andrew, emaste, brueffer, joel, wblock Cc: kostikbel, emaste, andrew, imp, freebsd-arm --b1_ef7558bf87cdf32496a347c12801e0cd Content-Type: text/x-patch; charset=utf-8; name="D2377.5364.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="D2377.5364.patch" ZGlmZiAtLWdpdCBhL3N5cy9jb25mL2ZpbGVzLmFybTY0IGIvc3lzL2NvbmYvZmlsZXMuYXJtNjQK LS0tIGEvc3lzL2NvbmYvZmlsZXMuYXJtNjQKKysrIGIvc3lzL2NvbmYvZmlsZXMuYXJtNjQKQEAg LTE5LDYgKzE5LDggQEAKIGFybTY0L2FybTY0L2VsZl9tYWNoZGVwLmMJc3RhbmRhcmQKIGFybTY0 L2FybTY0L2V4Y2VwdGlvbi5TCQlzd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192M19mZHRfYXR0YWNoKSwKKworCS8qIEVuZCAq LworCURFVk1FVEhPRF9FTkQKK307CisKK0RFRklORV9DTEFTU18xKGdpY192MywgZ2ljX3YzX2Zk dF9kcml2ZXIsIGdpY192M19mZHRfbWV0aG9kcywKKyAgICBzaXplb2Yoc3RydWN0IGdpY192M19z b2Z0YyksIGdpY192M19kcml2ZXIpOworCitzdGF0aWMgZGV2Y2xhc3NfdCBnaWNfdjNfZmR0X2Rl dmNsYXNzOworCitFQVJMWV9EUklWRVJfTU9EVUxFKGdpY192Mywgc2ltcGxlYnVzLCBnaWNfdjNf ZmR0X2RyaXZlciwgZ2ljX3YzX2ZkdF9kZXZjbGFzcywKKyAgICAwLCAwLCBCVVNfUEFTU19JTlRF UlJVUFQgKyBCVVNfUEFTU19PUkRFUl9NSURETEUpOworRUFSTFlfRFJJVkVSX01PRFVMRShnaWNf djMsIG9md2J1cywgZ2ljX3YzX2ZkdF9kcml2ZXIsIGdpY192M19mZHRfZGV2Y2xhc3MsCisgICAg MCwgMCwgQlVTX1BBU1NfSU5URVJSVVBUICsgQlVTX1BBU1NfT1JERVJfTUlERExFKTsKKworLyoK KyAqIERldmljZSBpbnRlcmZhY2UuCisgKi8KK3N0YXRpYyBpbnQKK2dpY192M19mZHRfcHJvYmUo ZGV2aWNlX3QgZGV2KQoreworCisJaWYgKG9md19idXNfc3RhdHVzX29rYXkoZGV2KSA9PSAwKQor CQlyZXR1cm4gKEVOWElPKTsKKworCWlmIChvZndfYnVzX2lzX2NvbXBhdGlibGUoZGV2LCAiYXJt LGdpYy12MyIpID09IDApCisJCXJldHVybiAoRU5YSU8pOworCisJZGV2aWNlX3NldF9kZXNjKGRl diwgR0lDX1YzX0RFVlNUUik7CisJcmV0dXJuIChCVVNfUFJPQkVfREVGQVVMVCk7Cit9CisKK3N0 YXRpYyBpbnQKK2dpY192M19mZHRfYXR0YWNoKGRldmljZV90IGRldikKK3sKKwlzdHJ1Y3QgZ2lj X3YzX3NvZnRjICpzYz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KKwlERVZNRVRIT0QocGljX21hc2ssCQlnaWNfdjNfbWFza19pcnEpLAorCURFVk1FVEhPRChw aWNfdW5tYXNrLAkJZ2ljX3YzX3VubWFza19pcnEpLAorCisJLyogRW5kICovCisJREVWTUVUSE9E X0VORAorfTsKKworREVGSU5FX0NMQVNTXzAoZ2ljX3YzLCBnaWNfdjNfZHJpdmVyLCBnaWNfdjNf bWV0aG9kcywKKyAgICBzaXplb2Yoc3RydWN0IGdpY192M19zb2Z0YykpOworCisvKgorICogRHJp dmVyLXNwZWNpZmljIGRlZmluaXRpb25zLgorICovCitNQUxMT0NfREVGSU5FKE1fR0lDX1YzLCAi R0lDdjMiLCBHSUNfVjNfREVWU1RSKTsKKworLyoKKyAqIEhlbHBlciBmdW5jdGlvbnMgYW5kIGRl ZmluaXRpb25zLgorICovCisvKiBEZXN0aW5hdGlvbiByZWdpc3RlcnMsIGVpdGhlciBEaXN0cmli dXRvciBvciBSZS1EaXN0cmlidXRvciAqLworZW51bSBnaWNfdjNfeGRpc3QgeworCURJU1QgPSAw LAorCVJFRElTVCwKK307CisKKy8qIEhlbHBlciByb3V0aW5lcyBzdGFydGluZyB3aXRoIGdpY192 M18gKi8KK3N0YXRpYyBpbnQgZ2ljX3YzX2Rpc3RfaW5pdChzdHJ1Y3QgZ2ljX3YzX3NvZnRjICop Oworc3RhdGljIGludCBnaWNfdjNfcmVkaXN0X2ZpbmQoc3RydWN0IGdpY192M19zb2Z0YyAqKTsK K3N0YXRpYyBpbnQgZ2ljX3YzX3JlZGlzdF9pbml0KHN0cnVjdCBnaWNfdjNfc29mdGMgKik7Citz dGF0aWMgaW50IGdpY192M19jcHVfaW5pdChzdHJ1Y3QgZ2ljX3YzX3NvZnRjICopOworc3RhdGlj IHZvaWQgZ2ljX3YzX3dhaXRfZm9yX3J3cChzdHJ1Y3QgZ2ljX3YzX3NvZnRjICosIGVudW0gZ2lj X3YzX3hkaXN0KTsKKworLyogQSBzZXF1ZW5jZSBvZiBpbml0IGZ1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cm4gKGVycik7CisKKwllcnIgPSBnaWNfdjNfcmVkaXN0X3dha2Uoc2MpOwor CWlmIChlcnIgIT0gMCkKKwkJcmV0dXJuIChlcnIpOworCisJLyogRGlzYWJsZSBTUElzICovCisJ Z2ljX3Jfd3JpdGUoc2MsIDQsIEdJQ1JfU0dJX0JBU0VfU0laRSArIEdJQ1JfSUNFTkFCTEVSMCwK KwkgICAgR0lDUl9JX0VOQUJMRVJfUFBJX01BU0spOworCS8qIEVuYWJsZSBTR0lzICovCisJZ2lj X3Jfd3JpdGUoc2MsIDQsIEdJQ1JfU0dJX0JBU0VfU0laRSArIEdJQ1JfSVNFTkFCTEVSMCwKKwkg ICAgR0lDUl9JX0VOQUJMRVJfU0dJX01BU0spOworCisJLyogU2V0IHByaW9yaXR5IGZvciBTR0lz IGFuZCBQUElzICovCisJZm9yIChpID0gMDsgaSA8PSBHSUNfTEFTVF9QUEk7IGkgKz0gR0lDUl9J X1BFUl9JUFJJT1JJVFluKSB7CisJCWdpY19yX3dyaXRlKHNjLCA0LCBHSUNSX1NHSV9CQVNFX1NJ WkUgKyBHSUNEX0lQUklPUklUWVIoaSksCisJCSAgICBHSUNfUFJJT1JJVFlfTUFYKTsKKwl9CisK KwlnaWNfdjNfd2FpdF9mb3JfcndwKHNjLCBSRURJU1QpOworCisJcmV0dXJuICgwKTsKK30KCg== --b1_ef7558bf87cdf32496a347c12801e0cd--