From owner-freebsd-mips@freebsd.org Mon Dec 21 05:02:24 2015 Return-Path: Delivered-To: freebsd-mips@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D16DDA4BA5B for ; Mon, 21 Dec 2015 05:02:24 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ig0-x234.google.com (mail-ig0-x234.google.com [IPv6:2607:f8b0:4001:c05::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A56B91399 for ; Mon, 21 Dec 2015 05:02:24 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-ig0-x234.google.com with SMTP id m11so24543016igk.1 for ; Sun, 20 Dec 2015 21:02:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=vf/4tSRiH8LPOYYqDf2mqvgyUazXtrDb8MvLaH0eP9I=; b=GdORY1RDajlKrDdnU0rxqo9PbvclG+2J+P53DSi+N3EnZ6CGnRfZPLCI63Y0l/pza7 3fexc/z/GJ2L63gbQ9vR7VJcCUdCjpeUVSsIKdZUhDpyzFqKzAR3rjkqVlTYGZb+JE/U UwiAEJh66mT62PWFBrZggjFDz2OBsyMo6kxzrQ4kFR8LpOjn04lg62y9MTJTcMouP5ho XrdUwvl2BB0bZg5owR0IU7+fsUSS46EDncMc8H8USXarD2Jqxd52lQCh7TpvrdknJ8Rx c43Hnsb7sc6Ubj7VqCgoduKcGXcB+l7nAU/YFaviF8V1XR2gjaffYK+HSr4zWkI2FFwS a0zw== MIME-Version: 1.0 X-Received: by 10.50.136.226 with SMTP id qd2mr16273143igb.37.1450674144006; Sun, 20 Dec 2015 21:02:24 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.36.121.202 with HTTP; Sun, 20 Dec 2015 21:02:23 -0800 (PST) Date: Sun, 20 Dec 2015 21:02:23 -0800 X-Google-Sender-Auth: HGn-fod5dtu5Sn_a6FWy52bMsXo Message-ID: Subject: L2 cache management and busdma - or, "damnit USB, who you not like me" From: Adrian Chadd To: "freebsd-mips@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2015 05:02:24 -0000 hi, I've been poking at the ci20 port to bring it up to self-booting/running, and this involves using USB1 as a rootfs. Yeah, I know, ohci, but that's what I have for now. Anyway, there was filesystem corruption, so I went digging into it and found that we just weren't taking L2 cache line size into account when doing the busdma bits. The JZ4780 SoC has 32 byte L1 lines, and 128 byte L2 lines. Oops! So, two things are needed: * for the ci20 port, which isn't in the mainline tree yet, we need to use USB_HOST_ALIGN=128, and * we need to teach the busdma code about the maximum line size, not just the L1 line size. Here's a diff that does the latter: https://people.freebsd.org/~adrian/mips/mips-fix-dcache-busdma.diff I'm going to test this out on my L1-only platforms (read: atheros) tomorrow. Does anyone have any comments? Thanks! -a