From owner-freebsd-hackers@FreeBSD.ORG Sun May 22 20:19:15 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 002CF106566B; Sun, 22 May 2011 20:19:14 +0000 (UTC) (envelope-from damjan.marion@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 527338FC15; Sun, 22 May 2011 20:19:13 +0000 (UTC) Received: by bwz12 with SMTP id 12so5905988bwz.13 for ; Sun, 22 May 2011 13:19:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to:x-mailer; bh=+WcYcxXk2hS5gFYis9DKJE8qojeoEirhB7nEbbmlOes=; b=tGGZamQe/ai31zhQAR/qab0hlhQIdf73Fd9f4uFQ3hp2v+muSQWlEyHBADNhoECs1L RNyXTZnJrmZo1LVLDBwChWEe/8EaPB9eI7dPac95sjWUIAQZp2aH7Wg2qyoF6gPOY5wY F43WHPDBTBtjygl7WP1pce7OA1qozG/7Cburg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=SnJqAI7Fg7SpmonvFGQ10BXikXqgr9P6dQ4iURX9RP3uGPj9/FNpjavH+qeAph1JKY x6XUSF4B+UugLNwzZq2ZYV2h/gTrcLzakgWTHFRV41/eOGhofHvZ/xTmwF74dzT+tOsi /qe3GASjXvdN8gzesAVtaJ4uD4TenQIsnnubY= Received: by 10.204.83.7 with SMTP id d7mr1360584bkl.206.1306095553054; Sun, 22 May 2011 13:19:13 -0700 (PDT) Received: from [192.168.123.4] (cpe-109-60-66-194.zg3.cable.xnet.hr [109.60.66.194]) by mx.google.com with ESMTPS id q25sm3468974bkk.10.2011.05.22.13.19.11 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 22 May 2011 13:19:12 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Damjan Marion In-Reply-To: <20110522180422.GA46973@ci0.org> Date: Sun, 22 May 2011 22:19:09 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20110522180422.GA46973@ci0.org> To: Olivier Houchard X-Mailer: Apple Mail (2.1084) Cc: freebsd-hackers@freebsd.org, freebsd-arm@freebsd.org Subject: Re: vm_fault when accessing PCI address space X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 May 2011 20:19:15 -0000 On May 22, 2011, at 8:04 PM, Olivier Houchard wrote: > On Sat, May 21, 2011 at 01:34:02AM +0200, Damjan Marion wrote: >>=20 >> Hi, >>=20 >=20 > Hi Damjan, >=20 >> I'm made some progress on porting existing marvell orion ARM code=20 >> to work on 88F5181L SoC which have embedded PCI controller. >>=20 >> PCI driver detects resources and recognizes Atheros wlan card,=20 >> however when driver tries to access 1st register with >> bus_space_write_4 vm_fault happens: >>=20 >> vm_fault(0xc0e4f000, e8007000, 2, 0) -> 1 >> Fatal kernel mode data abort: 'Translation Fault (S)' >> trapframe: 0xc0d3faa4 >> FSR=3D00000005, FAR=3De800704c, spsr=3D600000d3 >> r0 =3D00000000, r1 =3De8000000, r2 =3D0000704c, r3 =3D00000003 >> r4 =3Dc13cd000, r5 =3Dc0c4bd60, r6 =3Dc0bece04, r7 =3Dc12dd000 >> r8 =3D00000023, r9 =3Dc0d074c8, r10=3Dc0d3fba4, r11=3Dc0d3fb00 >> r12=3D00000000, ssp=3Dc0d3faf0, slr=3Dc095f830, pc =3Dc0bece04 >>=20 >> [ thread pid 0 tid 100000 ] >> Stopped at generic_bs_w_4: str r3, [r1, r2] >>=20 >> 0xe8000000 is PCI mem space. I can see that PCI driver (mv_pci.c) = allocates this resource: >>=20 >> pcib0: mem = 0xf1030000-0xf1031fff irq 0 on fdtbus0 >> pci0: on pcib0 >> mv_pcib_alloc_resource: start=3D0xe8000000 end=3D0xe800ffff = count=3D0x00010000 flags=3D0x00 >>=20 >> What can be the reason for this vm_fault?=20 >>=20 >=20 > I don't know the Marvell, nor the FDT code, well, but you shouldn't = access > to the PCI mem space using the physical address, so maybe something is = missing > from the dts ? > Also, reading the mv code, there's this in mv_machdep.c : > if (fdt_pci_devmap(child, &fdt_devmap[i], > MV_PCIE_IO_BASE, MV_PCIE_MEM_BASE) !=3D 0) > return (ENXIO); > but nothing equivalent for the PCI controller (as it seems the Orion = has both > PCI and PCIe). So maybe it is lacking ? Hi Olivier, yes, that code is wrong. It is inside loop so if there are 2 PCI = adapters=20 (i.e. PCIe + PCI) it will try to map both to same VA. Also different Marvell SoCs are using different PCI regions, so this = needs to be adjusted to work with my SoC. Thanks, Damjan