{"id":2224458,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2224458/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260417122213.147529-8-uros.stajic@htecgroup.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.2/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260417122213.147529-8-uros.stajic@htecgroup.com>","list_archive_url":null,"date":"2026-04-17T12:27:23","name":"[v7,7/7] riscv: p8700: Add Coherence Manager (CM) and IOCU support","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"c335f0473876642a46fbbf1b5fd95d3844294595","submitter":{"id":90991,"url":"http://patchwork.ozlabs.org/api/1.2/people/90991/?format=json","name":"Uros Stajic","email":"uros.stajic@htecgroup.com"},"delegate":{"id":20174,"url":"http://patchwork.ozlabs.org/api/1.2/users/20174/?format=json","username":"Andes","first_name":"Andes","last_name":"","email":"uboot@andestech.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260417122213.147529-8-uros.stajic@htecgroup.com/mbox/","series":[{"id":500329,"url":"http://patchwork.ozlabs.org/api/1.2/series/500329/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=500329","date":"2026-04-17T12:23:32","name":"riscv: Add support for P8700 platform on Boston board","version":7,"mbox":"http://patchwork.ozlabs.org/series/500329/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2224458/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2224458/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=htecgroup.com header.i=@htecgroup.com\n header.a=rsa-sha256 header.s=selector1 header.b=LO6hDpa6;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=htecgroup.com","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=htecgroup.com header.i=@htecgroup.com\n header.b=\"LO6hDpa6\";\n\tdkim-atps=neutral","phobos.denx.de; dmarc=pass (p=reject dis=none)\n header.from=htecgroup.com","phobos.denx.de;\n spf=pass smtp.mailfrom=uros.stajic@htecgroup.com","dkim=none (message not signed)\n header.d=none;dmarc=none action=none header.from=htecgroup.com;"],"Received":["from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fxvpW6p0gz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 22:49:23 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id D507D843D4;\n\tFri, 17 Apr 2026 14:44:09 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id 2C08384214; Fri, 17 Apr 2026 14:27:28 +0200 (CEST)","from DUZPR83CU001.outbound.protection.outlook.com\n (mail-northeuropeazlp170120005.outbound.protection.outlook.com\n [IPv6:2a01:111:f403:c200::5])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id DA26E83FC0\n for <u-boot@lists.denx.de>; Fri, 17 Apr 2026 14:27:25 +0200 (CEST)","from PA3PR09MB8140.eurprd09.prod.outlook.com (2603:10a6:102:4d4::20)\n by DB9PR09MB6059.eurprd09.prod.outlook.com (2603:10a6:10:3d8::20)\n with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9818.25; Fri, 17 Apr\n 2026 12:27:23 +0000","from PA3PR09MB8140.eurprd09.prod.outlook.com\n ([fe80::ca17:d4db:b6cd:fb81]) by PA3PR09MB8140.eurprd09.prod.outlook.com\n ([fe80::ca17:d4db:b6cd:fb81%2]) with mapi id 15.20.9818.023; Fri, 17 Apr 2026\n 12:27:23 +0000"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,\n SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2","ARC-Seal":"i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n b=OO7i7JUpK5LJVuNfNF2nn2R0uOujKOl3T5teXlv8oOt/bUENBOyLDVWqqsBWZduVycuDez3fsi0KIbWALfbezpUUiKc5LI3AvsJt2soBELnLE9yqEZjLDsCWF/MAvbo+AE16Ur4CkcDR30TaS5QCJLo+uS9D8j+0cwRU8Ho7off+o0mkbJyB70WPkXF5EN6tMN0bOWNdnnKjhpK0XdRQQDwMcNNkwfTU8g2b+afBCGRtv7cwldGaJf2XKehO+d2K6v9v4JEOh7IxhRNTflEx6YWopI/YLOami7MDTkys2qWevwbRK6Dt7MW3TivLor2Fx+NwNMGLVswNKL1TmYBH0A==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector10001;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n bh=tNGrQU56nbbJNJC2too1e7vZFM9oUUAj/ujP6qVBM0o=;\n b=G2JNqCX3MkQplyam2tSGOmNJQ20KnKL9W+oOU4LLYhvvrGa7Qn2qkep8BKa9bl1u2fhX3OL0m8YNtTJiB8XNhpGTy6Lv4wEbaVBUisHz8XQsjhGeZ25+Hs72bFKoEcX7xdHu/5j0r9QZ+SUIBxMQCip84wkOFCLcvfgxV7RAG8689JP8MVoVOj2Hya7YZehEqQXC9LqoRDm7zfuZ5CzncqQiK85IB3BRYZYMOy8Vb22VNrOfyKXxDHBszRKdaIFFt+Zigl/wibeUMqYYSyR3zR8/MYb16H8irlp4SsPW9HM7mMfkeA9Ok4pMl8IghJPw4dYluBoLW3QITi2UJtV2UA==","ARC-Authentication-Results":"i=1; mx.microsoft.com 1; spf=pass\n smtp.mailfrom=htecgroup.com; dmarc=pass action=none\n header.from=htecgroup.com; dkim=pass header.d=htecgroup.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=htecgroup.com;\n s=selector1;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=tNGrQU56nbbJNJC2too1e7vZFM9oUUAj/ujP6qVBM0o=;\n b=LO6hDpa6bj7GWHbw9yVNYZcpI4vsal7CJna4tV/JsF6NZr3+fuwQpoAHYUDc5c//S3RehcAdCF/GLyv+r6P8vrVXpRSn6uZg1xnKUWAThwkdDtiRJwGb5oDVtMKF647FqHcyOinYMfn/nqibIUb0LMbVBYdnRN6H62qEAoi5ZoAMKTiOnsJdr7BF2zr41F9v00JB04Z433dBzVLjrVYrEjZb91BD1j8FZ2BgpM5iubVURMddNOcH0sDoCYIACWUmyxu8Ic0mYzG+XmmcSzzpmoApH/qje6yCdrhqnB9fziZicOHHgUdA2IQrkKiC9C0c8v6RGt8olG8Ar+dBdzcI5Q==","From":"Uros Stajic <uros.stajic@htecgroup.com>","To":"\"u-boot@lists.denx.de\" <u-boot@lists.denx.de>","CC":"Djordje Todorovic <Djordje.Todorovic@htecgroup.com>, Leo Yu-Chi Liang\n <ycliang@andestech.com>, Rick Chen <rick@andestech.com>, Chao-ying Fu\n <cfu@mips.com>, Uros Stajic <uros.stajic@htecgroup.com>","Subject":"[PATCH v7 7/7] riscv: p8700: Add Coherence Manager (CM) and IOCU\n support","Thread-Topic":"[PATCH v7 7/7] riscv: p8700: Add Coherence Manager (CM) and IOCU\n support","Thread-Index":"AQHczmWLXQc6s/I9+ke6RVNxMaOzeQ==","Date":"Fri, 17 Apr 2026 12:27:23 +0000","Message-ID":"<20260417122213.147529-8-uros.stajic@htecgroup.com>","References":"<20260417122213.147529-1-uros.stajic@htecgroup.com>","In-Reply-To":"<20260417122213.147529-1-uros.stajic@htecgroup.com>","Accept-Language":"en-US","Content-Language":"en-US","X-MS-Has-Attach":"","X-MS-TNEF-Correlator":"","authentication-results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=htecgroup.com header.i=@htecgroup.com\n header.a=rsa-sha256 header.s=selector1 header.b=LO6hDpa6;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=htecgroup.com","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=htecgroup.com header.i=@htecgroup.com\n header.b=\"LO6hDpa6\";\n\tdkim-atps=neutral","phobos.denx.de; dmarc=pass (p=reject dis=none)\n header.from=htecgroup.com","phobos.denx.de;\n spf=pass smtp.mailfrom=uros.stajic@htecgroup.com","dkim=none (message not signed)\n header.d=none;dmarc=none action=none header.from=htecgroup.com;"],"x-ms-publictraffictype":"Email","x-ms-traffictypediagnostic":"PA3PR09MB8140:EE_|DB9PR09MB6059:EE_","x-ms-office365-filtering-correlation-id":"19c16975-878a-447a-8d9e-08de9c7cadba","x-ms-exchange-senderadcheck":"1","x-ms-exchange-antispam-relay":"0","x-microsoft-antispam":"BCL:0;\n ARA:13230040|376014|1800799024|366016|38070700021|56012099003|18002099003|22082099003;","x-microsoft-antispam-message-info":"\n PJl37gZmgkxqdR2ZJtASKa6Lod7q7CoW17rirTqToPGFNj6XWuQ1dbGG6V+Nf03QO3Le0QmUOBY7FdNcJH7LITl3j0/FNK04VciOz5UZMZsJJUE+KRLszYFU7tQRv9u3LWc8K/Jw43U1cCKXnA57oaNXuX61DfYIGspbiH0CxZdBGSYQPOkHT79auR6BKFlL4Otpmf4VkCclNZ6Cstnp9C/gClb4BsYfwGczHoLFVpjjoVho3aZeIIz30b8wNtkr/kD+wKjGw8yDjj7ycmaVOYJmpd11rTVUL9eW5XYbSw0jO1VEmPWlrttIAlMg2xsjY6QmSKw0x0o8F9MHSyRX1vkuFdrEKBHApkKSFdEsRxTS1SPDVSSBMFZcWW44P2Olf6vuDzY0EG7N4/Gjb/APFPdA+EM+UT8a91vXcKWBEVxGWp+mFBM0b7Gy0pxeGOhPHWe0mLyLYcNUkeG1rr/Jgb+dgM73CagVu358jZVatc5HTOrr+EcCCJDwh1KqAgQ6IQc2EMgS4ta2j+rLfw11D0UCkcqSCcwYDahWGVjJ2d29FSeo0pia35a88k3UebKb8YBJxmPWpcLU2SX4/OVwxF5CMlqMweEPfETmfWjYdNk0Pg4XitBxRHn/KxKW3LyFWBbndnQf3rY8Kbwq0DS89K4nMos/wxt//3qXv0/VYkYarx966u3EztuKSDiS7C46vm0ok8yzEquJmuxB1eCeP3Y29KvW4z//iF8EOVOw+rxku9SGVGcipUHiTm/oCbdU6ko6jx1Tq2pdcisxdZBbsvmLRhzWy6wDIdFEQJUapXA=","x-forefront-antispam-report":"CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n IPV:NLI; SFV:NSPM; H:PA3PR09MB8140.eurprd09.prod.outlook.com; PTR:; CAT:NONE;\n SFS:(13230040)(376014)(1800799024)(366016)(38070700021)(56012099003)(18002099003)(22082099003);\n DIR:OUT; SFP:1102;","x-ms-exchange-antispam-messagedata-chunkcount":"1","x-ms-exchange-antispam-messagedata-0":"=?iso-8859-1?q?fbGFG6x+IjvH4XBeCQlBBjM?=\n\t=?iso-8859-1?q?+ZOtxIde3zzWgKGIqGSH0OqrViAKOI/SPq37OMdo6Qob/Rf0s1EzTDuFWSJW?=\n\t=?iso-8859-1?q?OhRZVXnhWYlgx1EPSnsKY7eppAEcislr/i/4TBCq6X9D/HfsA/Si9qq5YdL6?=\n\t=?iso-8859-1?q?dBtZ3YPRW+C/MDir4TAoc5kABNnpWNgXZ8QoT5XpMXlMgsEguTPZT9hSHAjQ?=\n\t=?iso-8859-1?q?M7DJa1cyn+AHZJITIY/JcTE6e5Q4eLi/grF5FCIQgeG5hFu0G0/5IaGqmuLk?=\n\t=?iso-8859-1?q?/ZfIVQtAY46CIQlErmExRG29LHO64LVF5JOHSchWZb3iz8GrymOFsCGWMKJd?=\n\t=?iso-8859-1?q?9bn7tyh5dw2dx0yC+V6JgAJcWkx00ApHRGVR4pm5lT3DbWmiJheN2xWqNgBc?=\n\t=?iso-8859-1?q?MT7KoIbxw4KxdAtRsDzagCDk8JYoHhxdVfRreirFOiJqBNQIvy8/t/iqvnXc?=\n\t=?iso-8859-1?q?SBM/akCr7bLjkV32dbSzjKRpltrDpGzbprEHt6SN+kd3qmblI9cWTPBqDMYi?=\n\t=?iso-8859-1?q?XVZsOJyWAepyCh3pqzl/ybhFLky48Sv7nNUU1DZa/EJNQ87kI1xOFrROt8OC?=\n\t=?iso-8859-1?q?cMZrW5FRt3IRwoy9lYGnb71Qnu36QcZmQIUU3x0UXWFrosZEy1NqVGQI97jR?=\n\t=?iso-8859-1?q?hfOfZyalzvZsbzp+C4yvh+BSzMCWDzPcil1W59wfGOxzAMgfVGWNzZ0w7Le7?=\n\t=?iso-8859-1?q?xHn/xcK5ldtw08L7CchcDIHlLJYKE+pmLascKHSzAx1xtDxUFBV8gsr2WBVF?=\n\t=?iso-8859-1?q?v5bNsbFlZSwB4AmrT5MvIciu9nN3SEB1/ZAZ7OGq8Gpo0f5oxqFdzy8Y6KOg?=\n\t=?iso-8859-1?q?Zd3ITcHt8ghvOOxfpiQKJlsvpKgEwGro9Z/HzO+us4oDRJsBkyhLvEBg6MNQ?=\n\t=?iso-8859-1?q?ypfw6HyucrCOEldeJF5DdEKLSjOm2+wdwR1fCFA7roiJulWlGIHpp8rggUEk?=\n\t=?iso-8859-1?q?uRxyrXFJR6lN/itrK64RRiK6FSTWXvqVkwZYPDE4RG159Q1t8qJuiNGUSCpJ?=\n\t=?iso-8859-1?q?g+zIOIU3gVb/gV6h28TSJbGh6iFltKkz43IYir6FmwIOi8kxpBZ08G/BJcCY?=\n\t=?iso-8859-1?q?yncRT7TWBMiWfTkjikLEYVGR5v8o2997uvq4m+QjaBI84+EViM5WPJdN+qex?=\n\t=?iso-8859-1?q?SSnaLoYH/2GtJ+/YoC3jaixAMr8n4QHBU/11iEvEmbkVVHBg+1YLW51lmxw0?=\n\t=?iso-8859-1?q?jDvH71G6rZ5sxj1TGMAb/x8xpFsJPMJ+FxPy4UOcUvneWBTv8DLKTddnP4Mo?=\n\t=?iso-8859-1?q?zbdTZBoUZWyAyOE4160SNy+ze8l3Pd7tgQFEPRencZK2JVn1N+mn7Uu/TdES?=\n\t=?iso-8859-1?q?uTLt7fACSIMmzfzwOnURnbK05p/Uv3cDhjCg67pbtnXefaikywn2rGTqD0VR?=\n\t=?iso-8859-1?q?7AI83b+pBQm8kKcdLY1o2HvoGCnC7GFvNJ0nJkVsl8P8kJADgsMEkNG33s4a?=\n\t=?iso-8859-1?q?7O8AayKK3yJVGQIsRxrlY9k6wtzw/FLMupHnwW7MaVazSeIc58GLBKyq4TGo?=\n\t=?iso-8859-1?q?20sik9RfBc7X+yT+hGCWNoawc492UFHXUsXrZaB+ZJG4dD8Xw+xypjRWBYk+?=\n\t=?iso-8859-1?q?mQFFy5RrpTPmlaj7CsGRuqIO4Y/0haDRRbUlwhlbAFmqtiUYjw2Zq/up8ifb?=\n\t=?iso-8859-1?q?BGldlGCLuHa9CIjtK0o+VL9h6as9JzVhrJ4Dw42J4DHSyC8CjEqxF6soMeZt?=\n\t=?iso-8859-1?q?vp9DLMoJ0IwNk2H1XmaBFO/ZKkylrTE7aVxYc08sGww428oeWPEcQUrKWp1F?=\n\t=?iso-8859-1?q?HCST0ZZ3F08Ve2DU+gm+3iaMY59DQQW6iMY2m/RSN9l0sICXJCdOh/urBI/a?=\n\t=?iso-8859-1?q?A6/nLFog=3D?=","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","MIME-Version":"1.0","X-OriginatorOrg":"htecgroup.com","X-MS-Exchange-CrossTenant-AuthAs":"Internal","X-MS-Exchange-CrossTenant-AuthSource":"PA3PR09MB8140.eurprd09.prod.outlook.com","X-MS-Exchange-CrossTenant-Network-Message-Id":"\n 19c16975-878a-447a-8d9e-08de9c7cadba","X-MS-Exchange-CrossTenant-originalarrivaltime":"17 Apr 2026 12:27:23.7454 (UTC)","X-MS-Exchange-CrossTenant-fromentityheader":"Hosted","X-MS-Exchange-CrossTenant-id":"9f85665b-7efd-4776-9dfe-b6bfda2565ee","X-MS-Exchange-CrossTenant-mailboxtype":"HOSTED","X-MS-Exchange-CrossTenant-userprincipalname":"\n neE/Exuf1+Cx3dJ3+gbJ18lUjj87k3Bp+JjINCb1IX694kOIRjkajesNvnodk10G6RABS6nvZN4K5rS/7qK85erIbwAVYdRU5O+VvMpZioU=","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"DB9PR09MB6059","X-Mailman-Approved-At":"Fri, 17 Apr 2026 14:43:59 +0200","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"From: Chao-ying Fu <cfu@mips.com>\n\nAdd support for Coherence Manager (CM) and IOCU discovery and\nconfiguration on the P8700 platform.\n\nSigned-off-by: Chao-ying Fu <cfu@mips.com>\nSigned-off-by: Uros Stajic <uros.stajic@htecgroup.com>\n---\n arch/riscv/cpu/p8700/Makefile             |   2 +\n arch/riscv/cpu/p8700/cache.c              |   6 ++\n arch/riscv/cpu/p8700/cm-iocu.c            |  75 ++++++++++++++++\n arch/riscv/cpu/p8700/cm.c                 |  92 +++++++++++++++++++\n arch/riscv/cpu/p8700/p8700.c              |   2 +\n arch/riscv/include/asm/arch-p8700/cm.h    |  61 +++++++++++++\n arch/riscv/include/asm/arch-p8700/p8700.h |  32 +++++++\n arch/riscv/include/asm/global_data.h      |   4 +\n board/mips/boston-riscv/Makefile          |   1 +\n board/mips/boston-riscv/boston-riscv.c    |  11 +++\n board/mips/boston-riscv/iocu.c            | 102 ++++++++++++++++++++++\n 11 files changed, 388 insertions(+)\n create mode 100644 arch/riscv/cpu/p8700/cm-iocu.c\n create mode 100644 arch/riscv/cpu/p8700/cm.c\n create mode 100644 arch/riscv/include/asm/arch-p8700/cm.h\n create mode 100644 board/mips/boston-riscv/iocu.c","diff":"diff --git a/arch/riscv/cpu/p8700/Makefile b/arch/riscv/cpu/p8700/Makefile\nindex 04291375a29..45f68bbda3d 100644\n--- a/arch/riscv/cpu/p8700/Makefile\n+++ b/arch/riscv/cpu/p8700/Makefile\n@@ -3,6 +3,8 @@\n # Copyright (C) 2021, Chao-ying Fu <cfu@mips.com>\n \n obj-y += cache.o\n+obj-y += cm.o\n+obj-y += cm-iocu.o\n obj-y += cpu.o\n obj-y += dram.o\n obj-y += p8700.o\ndiff --git a/arch/riscv/cpu/p8700/cache.c b/arch/riscv/cpu/p8700/cache.c\nindex 06e60156394..1343637eea7 100644\n--- a/arch/riscv/cpu/p8700/cache.c\n+++ b/arch/riscv/cpu/p8700/cache.c\n@@ -48,6 +48,9 @@ static void probe_cache_config(void)\n \n void flush_dcache_range(unsigned long start, unsigned long end)\n {\n+\tif (dma_is_coherent())\n+\t\treturn;\n+\n \tif (lsize == 0)\n \t\tprobe_cache_config();\n \n@@ -71,6 +74,9 @@ void flush_dcache_range(unsigned long start, unsigned long end)\n \n void invalidate_dcache_range(unsigned long start, unsigned long end)\n {\n+\tif (dma_is_coherent())\n+\t\treturn;\n+\n \tif (lsize == 0)\n \t\tprobe_cache_config();\n \ndiff --git a/arch/riscv/cpu/p8700/cm-iocu.c b/arch/riscv/cpu/p8700/cm-iocu.c\nnew file mode 100644\nindex 00000000000..5850647d20f\n--- /dev/null\n+++ b/arch/riscv/cpu/p8700/cm-iocu.c\n@@ -0,0 +1,75 @@\n+// SPDX-License-Identifier: GPL-2.0+\n+/*\n+ * MIPS Coherence Manager (CM) Support\n+ *\n+ * Copyright (c) 2016 Imagination Technologies Ltd.\n+ */\n+#include <asm/io.h>\n+#include <asm/global_data.h>\n+#include <asm/arch-p8700/cm.h>\n+\n+__weak bool plat_iocu_usable(unsigned int cluster, unsigned int iocu)\n+{\n+\treturn true;\n+}\n+\n+static int init_cluster_iocus(unsigned int cluster)\n+{\n+\tDECLARE_GLOBAL_DATA_PTR;\n+\tvoid __iomem *global_gcrs;\n+\tu32 cfg, num_iocus, num_iocus_usable, local_cluster;\n+\tint i;\n+\n+\tlocal_cluster = mips_cluster_id();\n+\n+\tglobal_gcrs = mips_cm_base();\n+\tif (cluster != local_cluster) {\n+\t\t// FIXME\n+\t\treturn 1;\n+\t}\n+\n+\tcfg = __raw_readl(global_gcrs + GCR_CONFIG);\n+\tnum_iocus = cfg >> GCR_CONFIG_NUMIOCU_SHIFT;\n+\tnum_iocus &= GCR_CONFIG_NUMIOCU_MASK;\n+\tgd->arch.num_iocus += num_iocus;\n+\n+\t/* Discover how many IOCUs are usable */\n+\tnum_iocus_usable = num_iocus;\n+\tfor (i = num_iocus - 1; i >= 0; i--) {\n+\t\tif (!plat_iocu_usable(cluster, i))\n+\t\t\tnum_iocus_usable--;\n+\t}\n+\tgd->arch.num_iocus_usable += num_iocus_usable;\n+\n+\t/* If the cluster has no usable IOCUs there's nothing to do */\n+\tif (num_iocus_usable == 0) {\n+\t\tif (cluster != local_cluster)\n+\t\t\tpower_down_cluster(cluster);\n+\n+\t\treturn 0;\n+\t}\n+\n+\t/* If the IOCUs are in the local cluster we're good to go already */\n+\tif (cluster == local_cluster)\n+\t\treturn 0;\n+\n+\t/* Ensure that the cluster's L2 cache is initialised */\n+\treturn init_cluster_l2(cluster);\n+}\n+\n+int mips_cm_init_iocus(void)\n+{\n+\tDECLARE_GLOBAL_DATA_PTR;\n+\tunsigned int cluster;\n+\tint err;\n+\n+\tfor (cluster = 0; cluster < mips_cm_num_clusters(); cluster++) {\n+\t\terr = init_cluster_iocus(cluster);\n+\t\tif (err) {\n+\t\t\tgd->arch.num_iocus_usable = err;\n+\t\t\treturn 0;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\ndiff --git a/arch/riscv/cpu/p8700/cm.c b/arch/riscv/cpu/p8700/cm.c\nnew file mode 100644\nindex 00000000000..ce7485c564d\n--- /dev/null\n+++ b/arch/riscv/cpu/p8700/cm.c\n@@ -0,0 +1,92 @@\n+// SPDX-License-Identifier: GPL-2.0+\n+/*\n+ * MIPS Coherence Manager (CM) Support\n+ *\n+ * Copyright (c) 2016 Imagination Technologies Ltd.\n+ */\n+\n+#include <asm/io.h>\n+#include <asm/arch-p8700/cm.h>\n+#include <asm/arch-p8700/p8700.h>\n+\n+static void mips_cpc_init(void)\n+{\n+}\n+\n+__weak const struct mmio_region *get_mmio_regions(void)\n+{\n+\treturn NULL;\n+}\n+\n+static void p8700_setup_mmio_limits(void)\n+{\n+\tvoid __iomem *gcrs = mips_cm_base();\n+\tconst struct mmio_region *rgn = get_mmio_regions();\n+\tunsigned int num_clusters = mips_cm_num_clusters();\n+\tunsigned int limit = MIPS_CM_MMIO_LIMIT / num_clusters;\n+\tunsigned int i, reg_off;\n+\n+\tif (!rgn)\n+\t\treturn;\n+\n+\tif (num_clusters != 1) {\n+\t\t// FIXME! Need to support multiple clusters.\n+\t\treturn;\n+\t}\n+\n+\treg_off = GCR_MMIO0_BOTTOM;\n+\n+\tfor (i = 0; rgn[i].addr_high; i++) {\n+\t\t__raw_writeq(rgn[i].addr_high & GCR_MMIO0_TOP_ADDR,\n+\t\t\t     gcrs + reg_off + (GCR_MMIO0_TOP - GCR_MMIO0_BOTTOM));\n+\n+\t\t__raw_writeq((rgn[i].addr_low & GCR_MMIO0_BOTTOM_ADDR) |\n+\t\t\t     (rgn[i].port << GCR_MMIO0_BOTTOM_PORT_SHIFT) |\n+\t\t\t     (rgn[i].enable ? GCR_MMIO0_BOTTOM_ENABLE : 0),\n+\t\t\t     gcrs + reg_off);\n+\t\treg_off += GCR_MMIO1_BOTTOM - GCR_MMIO0_BOTTOM;\n+\t}\n+\n+\t__raw_writel(limit, gcrs + GCR_MMIO_REQ_LIMIT);\n+}\n+\n+int power_up_cluster(unsigned int cluster)\n+{\n+\treturn 0;\n+}\n+\n+int power_down_cluster(unsigned int cluster)\n+{\n+\treturn 0;\n+}\n+\n+int init_cluster_l2(unsigned int cluster)\n+{\n+\treturn 0;\n+}\n+\n+int mips_cm_init(void)\n+{\n+\tint err;\n+\n+\tmips_cpc_init();\n+\n+\terr = mips_cm_init_iocus();\n+\tif (err)\n+\t\treturn err;\n+\n+\tp8700_setup_mmio_limits();\n+\n+\treturn 0;\n+}\n+\n+int arch_cpu_init(void)\n+{\n+\tint err;\n+\n+\terr = mips_cm_init();\n+\tif (err)\n+\t\treturn err;\n+\n+\treturn 0;\n+}\ndiff --git a/arch/riscv/cpu/p8700/p8700.c b/arch/riscv/cpu/p8700/p8700.c\nindex 41d5547c511..802ec65ffb2 100644\n--- a/arch/riscv/cpu/p8700/p8700.c\n+++ b/arch/riscv/cpu/p8700/p8700.c\n@@ -10,3 +10,5 @@\n __weak void wait_ddr_calib(void) { }\n \n __weak void setup_pcie_dma_map(void) { }\n+\n+__weak bool dma_is_coherent(void) { return false; }\ndiff --git a/arch/riscv/include/asm/arch-p8700/cm.h b/arch/riscv/include/asm/arch-p8700/cm.h\nnew file mode 100644\nindex 00000000000..ab5ea7385b2\n--- /dev/null\n+++ b/arch/riscv/include/asm/arch-p8700/cm.h\n@@ -0,0 +1,61 @@\n+/* SPDX-License-Identifier: GPL-2.0 */\n+/*\n+ * Copyright (C) 2021, Chao-ying Fu <cfu@mips.com>\n+ */\n+\n+#ifndef __P8700_CM_H__\n+#define __P8700_CM_H__\n+\n+#include <asm/arch-p8700/p8700.h>\n+\n+struct mmio_region {\n+\tphys_addr_t addr_low;\n+\tphys_addr_t addr_high;\n+\tunsigned int port : 4;\n+\tunsigned int enable : 1;\n+};\n+\n+const struct mmio_region *get_mmio_regions(void);\n+\n+void setup_redirect(unsigned int cluster, unsigned int core,\n+\t\t    unsigned int vp, unsigned int block);\n+\n+int mips_cm_init_iocus(void);\n+\n+int power_up_cluster(unsigned int cluster);\n+int power_down_cluster(unsigned int cluster);\n+int init_cluster_l2(unsigned int cluster);\n+\n+static inline void *mips_cm_base(void)\n+{\n+\treturn (void *)CM_BASE;\n+}\n+\n+static inline void *mips_cpc_base(void)\n+{\n+\treturn (void *)CPC_BASE;\n+}\n+\n+static inline unsigned int mips_cm_num_clusters(void)\n+{\n+\tu32 cfg;\n+\n+\tcfg = __raw_readl(mips_cm_base() + GCR_CONFIG);\n+\tcfg >>= GCR_CONFIG_NUMCLUSTERS_SHIFT;\n+\tcfg &= GCR_CONFIG_NUMCLUSTERS_MASK;\n+\n+\treturn cfg;\n+}\n+\n+static inline unsigned int mips_cluster_id(void)\n+{\n+\tu32 temp;\n+\n+\tasm volatile(\"csrr %0, mhartid\" : \"=r\"(temp));\n+\ttemp >>= MHARTID_CLUSTER_SHIFT;\n+\ttemp &= MHARTID_CLUSTER_MASK;\n+\n+\treturn temp;\n+}\n+\n+#endif /* __P8700_CM_H__ */\ndiff --git a/arch/riscv/include/asm/arch-p8700/p8700.h b/arch/riscv/include/asm/arch-p8700/p8700.h\nindex d6cc125d76a..98ce5ba3ffb 100644\n--- a/arch/riscv/include/asm/arch-p8700/p8700.h\n+++ b/arch/riscv/include/asm/arch-p8700/p8700.h\n@@ -65,6 +65,10 @@\n #define CM_BASE\t\t\tCONFIG_RISCV_CM_BASE\n #define CPC_BASE\t\t(CM_BASE + 0x8000)\n \n+/* Block offsets */\n+#define GCR_OFF_GLOBAL\t\t0x0000\n+#define GCR_OFF_LOCAL\t\t0x2000\n+\n /* CPC Block offsets */\n #define CPC_OFF_LOCAL\t\t0x2000\n \n@@ -75,6 +79,33 @@\n #define CPC_Cx_CMD\t\t0x0000\n #define CPC_Cx_CMD_RESET\t0x4\n \n+/* GCR_CONFIG */\n+#define GCR_CONFIG\t\t\t\t\t\t0x0000\n+#define GCR_REV\t\t\t\t\t\t\t0x0030\n+#define GCR_CONFIG_NUMCLUSTERS_SHIFT\t23\n+#define GCR_CONFIG_NUMCLUSTERS_MASK\t    0x7f\n+#define GCR_CONFIG_NUMIOCU_SHIFT\t    8\n+#define GCR_CONFIG_NUMIOCU_MASK\t\t    0xf\n+#define GCR_CONFIG_NUMCORES_SHIFT\t    0\n+#define GCR_CONFIG_NUMCORES_MASK\t    0xff\n+\n+/* GCR_REV CM versions */\n+#define GCR_REV_CM3\t\t\t0x0800\n+#define GCR_REV_CM3_5\t\t0x0900\n+\n+#define GCR_MMIO_REQ_LIMIT\t\t\t\t0x06f8\n+#define GCR_MMIO0_BOTTOM\t\t\t\t0x0700\n+#define GCR_MMIO0_BOTTOM_ADDR\t\t\t(0xffffffffull << 16)\n+#define GCR_MMIO0_BOTTOM_PORT_SHIFT\t\t2\n+#define GCR_MMIO0_BOTTOM_PORT\t\t\t(0xf << 2)\n+#define GCR_MMIO0_BOTTOM_DISABLE_LIMIT\t(0x1 << 1)\n+#define GCR_MMIO0_BOTTOM_ENABLE\t\t\t(0x1 << 0)\n+#define GCR_MMIO0_TOP\t\t\t\t\t0x0708\n+#define GCR_MMIO0_TOP_ADDR\t\t\t\t(0xffffffffull << 16)\n+#define GCR_MMIO1_BOTTOM\t\t\t\t0x0710\n+\n+#define MIPS_CM_MMIO_LIMIT\t4\n+\n #define P8700_GCR_C0_COH_EN\t0x20f8\n #define P8700_GCR_C1_COH_EN\t0x21f8\n #define P8700_GCR_C2_COH_EN\t0x22f8\n@@ -97,5 +128,6 @@\n \n void wait_ddr_calib(void);\n void setup_pcie_dma_map(void);\n+bool dma_is_coherent(void);\n \n #endif /* __P8700_H__ */\ndiff --git a/arch/riscv/include/asm/global_data.h b/arch/riscv/include/asm/global_data.h\nindex 33f2b5ec5c8..198eacd1e07 100644\n--- a/arch/riscv/include/asm/global_data.h\n+++ b/arch/riscv/include/asm/global_data.h\n@@ -44,6 +44,10 @@ struct arch_global_data {\n \tulong smbios_start;\t\t/* Start address of SMBIOS table */\n #endif\n \tstruct resume_data *resume;\n+#if CONFIG_IS_ENABLED(P8700_RISCV)\n+\tint num_iocus;\n+\tint num_iocus_usable;\n+#endif\n };\n \n #include <asm-generic/global_data.h>\ndiff --git a/board/mips/boston-riscv/Makefile b/board/mips/boston-riscv/Makefile\nindex 0615c677d23..c67c001d4e6 100644\n--- a/board/mips/boston-riscv/Makefile\n+++ b/board/mips/boston-riscv/Makefile\n@@ -4,5 +4,6 @@\n \n obj-y += boston-riscv.o\n obj-y += checkboard.o\n+obj-y += iocu.o\n obj-y += lowlevel_init.o\n obj-y += reset.o\ndiff --git a/board/mips/boston-riscv/boston-riscv.c b/board/mips/boston-riscv/boston-riscv.c\nindex f3fd2ec8348..4af918c8c81 100644\n--- a/board/mips/boston-riscv/boston-riscv.c\n+++ b/board/mips/boston-riscv/boston-riscv.c\n@@ -46,3 +46,14 @@ void setup_pcie_dma_map(void)\n \twritel(0x00, (void __iomem *)BOSTON_PLAT_NOCPCIE1ADDR);\n \twritel(0x00, (void __iomem *)BOSTON_PLAT_NOCPCIE2ADDR);\n }\n+\n+bool dma_is_coherent(void)\n+{\n+\tu32 pcie0_off = readl((void __iomem *)BOSTON_PLAT_NOCPCIE0ADDR);\n+\tu32 pcie1_off = readl((void __iomem *)BOSTON_PLAT_NOCPCIE1ADDR);\n+\tu32 pcie2_off = readl((void __iomem *)BOSTON_PLAT_NOCPCIE2ADDR);\n+\n+\treturn pcie0_off == BOSTON_IOCU_NOC_OFFSET &&\n+\t       pcie1_off == BOSTON_IOCU_NOC_OFFSET &&\n+\t       pcie2_off == BOSTON_IOCU_NOC_OFFSET;\n+}\ndiff --git a/board/mips/boston-riscv/iocu.c b/board/mips/boston-riscv/iocu.c\nnew file mode 100644\nindex 00000000000..807f09804a3\n--- /dev/null\n+++ b/board/mips/boston-riscv/iocu.c\n@@ -0,0 +1,102 @@\n+// SPDX-License-Identifier: GPL-2.0+\n+/*\n+ * Copyright (c) 2016 Imagination Technologies Ltd.\n+ */\n+\n+#include \"boston-regs.h\"\n+#include <dm.h>\n+#include <env_callback.h>\n+#include <event.h>\n+#include <asm/io.h>\n+#include <asm/arch-p8700/cm.h>\n+\n+static const struct mmio_region mmio_regions[] = {\n+\t{ 0x10000000, 0x160f0000, .enable = 1 },\n+\t{ 0x17ff0000, 0x17ff0000, .enable = 1 },\n+\t{ 0 },\n+};\n+\n+const struct mmio_region *get_mmio_regions(void)\n+{\n+\treturn mmio_regions;\n+}\n+\n+static int set_io_coherent(bool coherent)\n+{\n+\tDECLARE_GLOBAL_DATA_PTR;\n+\n+\tif (!coherent) {\n+\t\tprintf(\"I/O:   Non-Coherent (Forced by environment)\\n\");\n+\t\tgoto noncoherent;\n+\t}\n+\n+\tif (gd->arch.num_iocus_usable < 0) {\n+\t\tprintf(\"I/O:   Non-Coherent (IOCU init error %d)\\n\",\n+\t\t       gd->arch.num_iocus_usable);\n+\t\tgoto noncoherent;\n+\t}\n+\n+\tif (gd->arch.num_iocus == 0) {\n+\t\tprintf(\"I/O:   Non-Coherent (No IOCU)\\n\");\n+\t\tgoto noncoherent;\n+\t}\n+\n+\tif (gd->arch.num_iocus_usable == 0) {\n+\t\tprintf(\"I/O:   Non-Coherent (IOCU not connected)\\n\");\n+\t\tgoto noncoherent;\n+\t}\n+\n+\t/*\n+\t * We have some number of connected IOCUs. Map all PCIe DMA access to\n+\t * hit the IOCU by offsetting the addresses as they pass from the PCIe\n+\t * controller to the NoC.\n+\t */\n+\twritel(0x10, (u32 *)BOSTON_PLAT_NOCPCIE0ADDR);\n+\twritel(0x10, (u32 *)BOSTON_PLAT_NOCPCIE1ADDR);\n+\twritel(0x10, (u32 *)BOSTON_PLAT_NOCPCIE2ADDR);\n+\n+\tprintf(\"I/O:   Coherent\\n\");\n+\treturn 0;\n+\n+noncoherent:\n+\t/* Map all PCIe DMA access to its default, non-IOCU, target */\n+\twritel(0x00, (u32 *)BOSTON_PLAT_NOCPCIE0ADDR);\n+\twritel(0x00, (u32 *)BOSTON_PLAT_NOCPCIE1ADDR);\n+\twritel(0x00, (u32 *)BOSTON_PLAT_NOCPCIE2ADDR);\n+\t\n+\treturn 0;\n+}\n+\n+static int on_io_coherent(const char *name, const char *value,\n+\t\t\t  enum env_op op, int flags)\n+{\n+\tswitch (op) {\n+\tcase env_op_create:\n+\tcase env_op_overwrite:\n+\t\tif (!strcmp(value, \"0\")) {\n+\t\t\tset_io_coherent(false);\n+\t\t} else if (!strcmp(value, \"1\")) {\n+\t\t\tset_io_coherent(true);\n+\t\t} else {\n+\t\t\tprintf(\"### io.coherent must equal 0 or 1\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\treturn 0;\n+\n+\tcase env_op_delete:\n+\t\tset_io_coherent(true);\n+\t\treturn 0;\n+\n+\tdefault:\n+\t\treturn 0;\n+\t}\n+}\n+\n+U_BOOT_ENV_CALLBACK(io_coherent, on_io_coherent);\n+\n+static int p8700_misc_init_f(void)\n+{\n+\treturn set_io_coherent(env_get_yesno(\"io.coherent\") != 0);\n+}\n+\n+EVENT_SPY_SIMPLE(EVT_MISC_INIT_F, p8700_misc_init_f);\n","prefixes":["v7","7/7"]}