Re: [PATCH] tty: serial: omap: increase max consoles to 10
On 10/21/2014 06:23 PM, Nishanth Menon wrote: The final solution is to transition off to use 8250 driver and no dependency on console structures and move away from omap-serial driver, hence no major cleanups are done for this driver. So the shiny new driver works for you, is this what you are saying? diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 18c30ca..4f9cbb6 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -46,7 +46,7 @@ #include dt-bindings/gpio/gpio.h -#define OMAP_MAX_HSUART_PORTS6 +#define OMAP_MAX_HSUART_PORTS10 #define UART_BUILD_REVISION(x, y)(((x) 8) | (y)) Please also add a check in the probe code that up-port.line does not exceed OMAP_MAX_HSUART_PORTS again. So we leave the probe function with an error code instead. Sebastian -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/5] OMAPDSS: fix dispc register dump for preload mflag
Preload register is dumped twice for video overlays and mflag register is not dumped for GFX. Fix the register dump. Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com --- drivers/video/fbdev/omap2/dss/dispc.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c index e67976bd0627..0e9a74bb9fc2 100644 --- a/drivers/video/fbdev/omap2/dss/dispc.c +++ b/drivers/video/fbdev/omap2/dss/dispc.c @@ -3290,8 +3290,11 @@ static void dispc_dump_regs(struct seq_file *s) DUMPREG(i, DISPC_OVL_FIFO_SIZE_STATUS); DUMPREG(i, DISPC_OVL_ROW_INC); DUMPREG(i, DISPC_OVL_PIXEL_INC); + if (dss_has_feature(FEAT_PRELOAD)) DUMPREG(i, DISPC_OVL_PRELOAD); + if (dss_has_feature(FEAT_MFLAG)) + DUMPREG(i, DISPC_OVL_MFLAG_THRESHOLD); if (i == OMAP_DSS_GFX) { DUMPREG(i, DISPC_OVL_WINDOW_SKIP); @@ -3312,10 +3315,6 @@ static void dispc_dump_regs(struct seq_file *s) } if (dss_has_feature(FEAT_ATTR2)) DUMPREG(i, DISPC_OVL_ATTRIBUTES2); - if (dss_has_feature(FEAT_PRELOAD)) - DUMPREG(i, DISPC_OVL_PRELOAD); - if (dss_has_feature(FEAT_MFLAG)) - DUMPREG(i, DISPC_OVL_MFLAG_THRESHOLD); } #undef DISPC_REG -- 2.1.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/5] OMAPDSS: HDMI: fix PLL GO bit handling
The PLL settings are committed by setting GO bit, which is then cleared by the HW when the settings have been taken into use. The current PLL code handles this wrong: instead of waiting for the bit to be cleared, it waits for the bit to be set. Usually, the bit is always set, as the CPU has just set it before. However, if the CPU takes enough time between setting the GO bit and checking it, the HW may already have cleared the bit and this leads to timeout error. Fix the wait to check the bit properly. Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com --- drivers/video/fbdev/omap2/dss/hdmi_pll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/omap2/dss/hdmi_pll.c b/drivers/video/fbdev/omap2/dss/hdmi_pll.c index 54df12a8d744..d4ec815ba42e 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi_pll.c +++ b/drivers/video/fbdev/omap2/dss/hdmi_pll.c @@ -144,8 +144,8 @@ static int hdmi_pll_config(struct hdmi_pll_data *pll) /* wait for bit change */ if (hdmi_wait_for_bit_change(pll-base, PLLCTRL_PLL_GO, - 0, 0, 1) != 1) { - DSSERR(PLL GO bit not set\n); + 0, 0, 0) != 0) { + DSSERR(PLL GO bit not clearing\n); return -ETIMEDOUT; } -- 2.1.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/5] OMAPDSS: HDMI: fix regsd write
HDMI PLL's REGSD field is only set by the driver if the PLL's output clock is over 1GHz. This is clearly an error, as REGSD should be set always. Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com --- drivers/video/fbdev/omap2/dss/hdmi_pll.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/video/fbdev/omap2/dss/hdmi_pll.c b/drivers/video/fbdev/omap2/dss/hdmi_pll.c index d4ec815ba42e..6d92bb32fe51 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi_pll.c +++ b/drivers/video/fbdev/omap2/dss/hdmi_pll.c @@ -124,16 +124,15 @@ static int hdmi_pll_config(struct hdmi_pll_data *pll) r = FLD_MOD(r, 0x0, 14, 14);/* PHY_CLKINEN de-assert during locking */ r = FLD_MOD(r, fmt-refsel, 22, 21);/* REFSEL */ - if (fmt-dcofreq) { - /* divider programming for frequency beyond 1000Mhz */ - REG_FLD_MOD(pll-base, PLLCTRL_CFG3, fmt-regsd, 17, 10); + if (fmt-dcofreq) r = FLD_MOD(r, 0x4, 3, 1); /* 1000MHz and 2000MHz */ - } else { + else r = FLD_MOD(r, 0x2, 3, 1); /* 500MHz and 1000MHz */ - } hdmi_write_reg(pll-base, PLLCTRL_CFG2, r); + REG_FLD_MOD(pll-base, PLLCTRL_CFG3, fmt-regsd, 17, 10); + r = hdmi_read_reg(pll-base, PLLCTRL_CFG4); r = FLD_MOD(r, fmt-regm2, 24, 18); r = FLD_MOD(r, fmt-regmf, 17, 0); -- 2.1.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/5] OMAPDSS: DISPC: fix mflag offset
The register offset for DISPC_OVL_MFLAG_THRESHOLD is wrong, fix it. Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com --- drivers/video/fbdev/omap2/dss/dispc.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/video/fbdev/omap2/dss/dispc.h b/drivers/video/fbdev/omap2/dss/dispc.h index 78edb449c763..3043d6e0a5f9 100644 --- a/drivers/video/fbdev/omap2/dss/dispc.h +++ b/drivers/video/fbdev/omap2/dss/dispc.h @@ -101,8 +101,7 @@ DISPC_FIR_COEF_V2_OFFSET(n, i)) #define DISPC_OVL_PRELOAD(n) (DISPC_OVL_BASE(n) + \ DISPC_PRELOAD_OFFSET(n)) -#define DISPC_OVL_MFLAG_THRESHOLD(n) (DISPC_OVL_BASE(n) + \ - DISPC_MFLAG_THRESHOLD_OFFSET(n)) +#define DISPC_OVL_MFLAG_THRESHOLD(n) DISPC_MFLAG_THRESHOLD_OFFSET(n) /* DISPC up/downsampling FIR filter coefficient structure */ struct dispc_coef { -- 2.1.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/5] OMAPDSS: DSI: Fix PLL_SELFEQDCO field width
PLL_SELFREQDCO bitfield is from bit 3 to 1, but the driver writes bits from 4 to 1. The bit 4 is 'reserved', so this probably should not cause any issues, but it's better to fix it. Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com --- drivers/video/fbdev/omap2/dss/dsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/omap2/dss/dsi.c b/drivers/video/fbdev/omap2/dss/dsi.c index 947bd7b93375..0793bc67a275 100644 --- a/drivers/video/fbdev/omap2/dss/dsi.c +++ b/drivers/video/fbdev/omap2/dss/dsi.c @@ -1603,7 +1603,7 @@ int dsi_pll_set_clock_div(struct platform_device *dsidev, } else if (dss_has_feature(FEAT_DSI_PLL_SELFREQDCO)) { f = cinfo-clkin4ddr 10 ? 0x2 : 0x4; - l = FLD_MOD(l, f, 4, 1);/* PLL_SELFREQDCO */ + l = FLD_MOD(l, f, 3, 1);/* PLL_SELFREQDCO */ } l = FLD_MOD(l, 1, 13, 13); /* DSI_PLL_REFEN */ -- 2.1.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 09/12] rtc: omap: add support for pmic_power_en
On Fri, Oct 10, 2014 at 01:07:27PM -0500, Felipe Balbi wrote: On Thu, Oct 09, 2014 at 09:06:31PM +0200, Johan Hovold wrote: - /* clear pending irqs, and set 1/second periodic, -* which we'll use instead of update irqs + /* +* disable interrupts +* +* NOTE: ALARM2 is not cleared on AM3352 if rtc_write (writeb) is used */ - rtc_write(0, OMAP_RTC_INTERRUPTS_REG); + rtc_writel(0, OMAP_RTC_INTERRUPTS_REG); bug fix, should be part of a separate patch and Cc stable :-) I made this a separate fix in v2 but did not mark it for stable for now as no one has been bitten by it (ALARM2 is never enabled by the current driver). Johan -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 00/12] rtc: omap: fixes and power-off feature
On Wed, Oct 15, 2014 at 12:08:32PM -0500, Felipe Balbi wrote: On Wed, Oct 15, 2014 at 07:06:28PM +0200, Johan Hovold wrote: On Wed, Oct 15, 2014 at 11:55:02AM -0500, Felipe Balbi wrote: BTW, how do you test this series ? Set a 30 second wakealarm using the sysfs attribute of the rtc class device and power off the BBB: echo +30 wakealarm; poweroff sweet It worked just fine :-) :) Too bad there's yet another DRM bug: [ 271.150158] Kernel panic - not syncing: Attempted to kill init! exitcode=0x [ 271.150158] [ 271.159725] CPU: 0 PID: 1 Comm: systemd-shutdow Not tainted 3.17.0-08392-g7fe2269-dirty #326 [ 271.168567] [c00175a4] (unwind_backtrace) from [c00132f0] (show_stack+0x20/0x24) [ 271.176668] [c00132f0] (show_stack) from [c06573a4] (dump_stack+0x8c/0xa4) [ 271.184215] [c06573a4] (dump_stack) from [c0654f10] (panic+0xa0/0x220) [ 271.191405] [c0654f10] (panic) from [c0049e54] (do_exit+0x974/0x9d0) [ 271.198410] [c0049e54] (do_exit) from [c0067694] (SyS_reboot+0x14c/0x1e8) [ 271.205870] [c0067694] (SyS_reboot) from [c000f080] (ret_fast_syscall+0x0/0x48) [ 271.214023] drm_kms_helper: panic occurred, switching back to text console [ 271.221312] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x In any case, board still powered up after 30 seconds(-ish). So this gets a: Tested-by: Felipe Balbi ba...@ti.com Thanks for testing. I didn't include your Tested-by in v2 due to the invasiveness of the new device-abstraction patch. Still works fine on BBB here though. Johan -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 08/12] rtc: omap: restore irq state after reading TC registers
On Sat, Oct 11, 2014 at 07:47:58PM -0500, Felipe Balbi wrote: On Sat, Oct 11, 2014 at 12:12:01PM +0200, Johan Hovold wrote: On Fri, Oct 10, 2014 at 01:02:31PM -0500, Felipe Balbi wrote: Hi, On Thu, Oct 09, 2014 at 09:06:30PM +0200, Johan Hovold wrote: Make sure to restore local irq state when reading the timer/calendar (TC) registers, so that omap_rtc_read_time() can be called with interrupts disabled. Signed-off-by: Johan Hovold jo...@kernel.org --- drivers/rtc/rtc-omap.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 0ef016553a97..62e2e9a9887a 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c @@ -239,8 +239,10 @@ static void bcd2tm(struct rtc_time *tm) static int omap_rtc_read_time(struct device *dev, struct rtc_time *tm) { + unsigned long flags; + /* we don't report wday/yday/isdst ... */ - local_irq_disable(); + local_irq_save(flags); you should really convert these to a real spin_lock_irq*(), that's because local_irq* do not get re-written with RT patchset, so this pretty much breaks RT. The driver uses local_irq* throughout to guarantee registers are not read or written during an update event. In fact, at least on AM33xx, this is not even necessary when reading (as opposed to writing) the TC registers, but I did not dare change that without knowing how the legacy platforms work in this respect. Do you suggest doing this conversion as part of, or on top of, this series? probably on top of is. Safer that way. I didn't include this conversion in v2 as you may have noticed. In fact, I'm not even sure it should be done. Using local_irq* breaks RT, but if we change it to spin_lock_irq* and RT preempts us, we may miss the 15us access window which would break the driver: If the ARM accesses the TC registers outside of the access period, then the access is not guaranteed. On am33xx this only affects updating the TC (timer/calendar) or alarm registers, but the driver currently disables interrupts also on reading the time (possibly because the early IP revisions did not have the shadow read registers). Johan -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 00/12] rtc: omap: fixes and power-off feature
On Sat, Oct 11, 2014 at 12:08:18PM -0700, Tony Lindgren wrote: * Johan Hovold jo...@kernel.org [141011 02:42]: On Fri, Oct 10, 2014 at 12:54:22PM -0500, Felipe Balbi wrote: is this power-off feature RTC-only mode ? Yes, I believe so, at least as long as RTC power is maintained. The pmic_power_en pin can otherwise still be used to power off. On the BeagleBone the PMIC can be configured to enter OFF or SLEEP mode on power off, where the latter (and default) mode keeps the RTC power supply enabled. Thanks for the fast review, Felipe. Great :) I assume adding the regulator support to this driver should also help in the 35xx case? If I remember correctly both OMAP and Sitara 35xx have no on-chip RTC so they won't be using this driver. That is assuming that RTC power can be configured as a Linux regulator on 35xx. Johan -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 2/4] phy: exynos5-usbdrd: Add pipe-clk and utmi-clk support
Hi, On Tuesday 07 October 2014 03:49 PM, Vivek Gautam wrote: Exynos7 SoC has now separate gate control for 125MHz pipe3 phy clock, as well as 60MHz utmi phy clock. So get the same and control in the phy-exynos5-usbdrd driver. Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- .../devicetree/bindings/phy/samsung-phy.txt|4 drivers/phy/phy-exynos5-usbdrd.c | 22 2 files changed, 26 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt index 15e0f2c..c2bc9dc 100644 --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt @@ -138,6 +138,10 @@ Required properties: PHY operations, associated by phy name. It is used to determine bit values for clock settings register. For Exynos5420 this is given as 'sclk_usbphy30' in CMU. + - optional clocks: Exynos7 SoC has now following additional +gate clocks available: +- phy_pipe: for PIPE3 phy +- phy_utmi: for UTMI+ phy - samsung,pmu-syscon: phandle for PMU system controller interface, used to control pmu registers for power isolation. - #phy-cells : from the generic PHY bindings, must be 1; diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c index f756aca..013ee84 100644 --- a/drivers/phy/phy-exynos5-usbdrd.c +++ b/drivers/phy/phy-exynos5-usbdrd.c @@ -148,6 +148,8 @@ struct exynos5_usbdrd_phy_drvdata { * @dev: pointer to device instance of this platform device * @reg_phy: usb phy controller register memory base * @clk: phy clock for register access + * @pipeclk: clock for pipe3 phy + * @utmiclk: clock for utmi+ phy * @drv_data: pointer to SoC level driver data structure * @phys[]: array for 'EXYNOS5_DRDPHYS_NUM' number of PHY * instances each with its 'phy' and 'phy_cfg'. @@ -161,6 +163,8 @@ struct exynos5_usbdrd_phy { struct device *dev; void __iomem *reg_phy; struct clk *clk; + struct clk *pipeclk; + struct clk *utmiclk; const struct exynos5_usbdrd_phy_drvdata *drv_data; struct phy_usb_instance { struct phy *phy; @@ -446,6 +450,8 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy) dev_dbg(phy_drd-dev, Request to power_on usbdrd_phy phy\n); + clk_prepare_enable(phy_drd-utmiclk); + clk_prepare_enable(phy_drd-pipeclk); We can have a separate function for powering on/off usb3 phy and usb2 phy independently. That way if the USB controller is operating only on high speed mode, the pipe clock need not be enabled at all. I think we should create separate PHYs (phy_create) for usb2 phy and usb3 phy here. Please refer how Lee Jones did that for miphy365x modelling each PHY as a child node to the PHY provider and doing phy_create for each child node. Thanks Kishon -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] tty: serial: omap: increase max consoles to 10
On 10:03-20141022, Sebastian Andrzej Siewior wrote: On 10/21/2014 06:23 PM, Nishanth Menon wrote: The final solution is to transition off to use 8250 driver and no dependency on console structures and move away from omap-serial driver, hence no major cleanups are done for this driver. So the shiny new driver works for you, is this what you are saying? We have to complete our transition over to the new driver to see if we have any behavior change. We will eventually get there. diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 18c30ca..4f9cbb6 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -46,7 +46,7 @@ #include dt-bindings/gpio/gpio.h -#define OMAP_MAX_HSUART_PORTS 6 +#define OMAP_MAX_HSUART_PORTS 10 #define UART_BUILD_REVISION(x, y) (((x) 8) | (y)) Please also add a check in the probe code that up-port.line does not exceed OMAP_MAX_HSUART_PORTS again. So we leave the probe function with an error code instead. Thanks. yeah - that is a pretty good idea. Will do the same for v2. -- Regards, Nishanth Menon -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V2] tty: serial: omap: Increase max consoles and add check to prevent crash
Increase the maximum number of consoles possible to 10 since DRA7 now has the maximum number of consoles possible. without doing this, for example, enabling DRA7 UART10 results in internal data structures and console cannot match up and we endup with a crash as follows: [1.903503] omap_uart 48424000.serial: [UART-1]: failure [serial_omap_probe]: -22 [1.911437] omap_uart: probe of 48424000.serial failed with error -22 [1.920379] Unable to handle kernel NULL pointer dereference at virtual address 0004 [1.928894] pgd = c0004000 [1.931732] [0004] *pgd= [1.935485] Internal error: Oops: 5 [#1] SMP ARM [1.940338] Modules linked in: [1.943542] CPU: 1 PID: 12 Comm: kworker/1:0 Tainted: GW 3.18.0-rc1-1-g8821bc4-dirty #6 [1.953521] task: ed8a2d00 ti: ed8a4000 task.ti: ed8a4000 [1.959197] PC is at process_one_work+0x38/0x4a4 [1.964050] LR is at 0x0 [1.966705] pc : [c00548e0]lr : []psr: 4093 [1.966705] sp : ed8a5ea8 ip : ed8a5ec8 fp : eeb9abc0 [1.978759] r10: ed8a4000 r9 : 0008 r8 : ed842458 [1.984252] r7 : r6 : eeb9abc0 r5 : ed842440 r4 : edbf26a8 [1.991119] r3 : r2 : r1 : r0 : [1.997985] Flags: nZcv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel [2.005767] Control: 10c5387d Table: 8000406a DAC: 0015 [2.011810] Process kworker/1:0 (pid: 12, stack limit = 0xed8a4248) [2.018371] Stack: (0xed8a5ea8 to 0xed8a6000) [2.022949] 5ea0: 0001 6093 c008346c 0001 ed8a5ec8 [2.031555] 5ec0: c0054de4 eeb9abc0 ed8a4000 ed842458 0008 ed8a4000 eeb9abc0 ed842440 [2.040161] 5ee0: eeb9abc0 eeb9abf0 ed8a4000 ed842458 0008 ed8a4000 eeb9abc0 c0054ec4 [2.048767] 5f00: ed8a4000 eeb9ac4c a053 ed845bc0 ed842440 c0054d80 [2.057342] 5f20: c005999c 0001 c05eaa64 ed842440 [2.065948] 5f40: dead4ead c097c680 [2.074554] 5f60: c078acd4 ed8a5f64 ed8a5f64 dead4ead [2.083160] 5f80: c097c680 c078acd4 ed8a5f90 ed8a5f90 60d3 ed845bc0 [2.091766] 5fa0: c00598d4 c000e668 [2.100341] 5fc0: [2.108947] 5fe0: 0013 90005148 11010482 [2.117553] [c00548e0] (process_one_work) from [c0054ec4] (worker_thread+0x144/0x498) [2.126159] [c0054ec4] (worker_thread) from [c005999c] (kthread+0xc8/0xe4) [2.133758] [c005999c] (kthread) from [c000e668] (ret_from_fork+0x14/0x2c) [2.141357] Code: e1a04001 e1a05000 e893000f e31e0004 (e5978004) [2.147766] ---[ end trace 5798e2803311b69f ]--- snip The final solution is to transition off to use 8250 driver and no dependency on console structures and move away from omap-serial driver, hence no major cleanups are done for this driver, so add a simple check to prevent future crashes in a similar manner in case of platform with additional ports. Signed-off-by: Nishanth Menon n...@ti.com --- drivers/tty/serial/omap-serial.c |9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 18c30ca..b0fe462 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -46,7 +46,7 @@ #include dt-bindings/gpio/gpio.h -#define OMAP_MAX_HSUART_PORTS 6 +#define OMAP_MAX_HSUART_PORTS 10 #define UART_BUILD_REVISION(x, y) (((x) 8) | (y)) @@ -1693,6 +1693,13 @@ static int serial_omap_probe(struct platform_device *pdev) goto err_port_line; } + if (up-port.line = OMAP_MAX_HSUART_PORTS) { + dev_err(pdev-dev, uart ID %d MAX %d.\n, up-port.line, + OMAP_MAX_HSUART_PORTS); + ret = -ENXIO; + goto err_port_line; + } + ret = serial_omap_probe_rs485(up, pdev-dev.of_node); if (ret 0) goto err_rs485; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 12/17] iommu/omap: Integrate omap-iommu-debug into omap-iommu
On Tue, Oct 21, 2014 at 04:28:27PM -0500, Suman Anna wrote: I am looking to refresh this series for 3.19, and this is the only patch that may need some changes. Please let me know what your preference is, and I can rework this patch if needed. Either way, the plan is to not have an OMAP IOMMU debugfs module, but only to have an option not to build the debugfs portions. Can I apply this series without this patch and you send me an updated version of only this patch? If yes, please let me know, otherwise please rebase the series on v3.18-rc1 and resend. Thanks, Joerg -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 00/12] rtc: omap: fixes and power-off feature
* Johan Hovold jo...@kernel.org [141022 04:12]: On Sat, Oct 11, 2014 at 12:08:18PM -0700, Tony Lindgren wrote: * Johan Hovold jo...@kernel.org [141011 02:42]: On Fri, Oct 10, 2014 at 12:54:22PM -0500, Felipe Balbi wrote: is this power-off feature RTC-only mode ? Yes, I believe so, at least as long as RTC power is maintained. The pmic_power_en pin can otherwise still be used to power off. On the BeagleBone the PMIC can be configured to enter OFF or SLEEP mode on power off, where the latter (and default) mode keeps the RTC power supply enabled. Thanks for the fast review, Felipe. Great :) I assume adding the regulator support to this driver should also help in the 35xx case? If I remember correctly both OMAP and Sitara 35xx have no on-chip RTC so they won't be using this driver. Sorry I made a typo.. I meanto to ask if adding the regulator helps in your 335x case (not 35xx case)? Regards, Tony -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 00/12] rtc: omap: fixes and power-off feature
On Wed, Oct 22, 2014 at 08:29:56AM -0700, Tony Lindgren wrote: * Johan Hovold jo...@kernel.org [141022 04:12]: On Sat, Oct 11, 2014 at 12:08:18PM -0700, Tony Lindgren wrote: * Johan Hovold jo...@kernel.org [141011 02:42]: On Fri, Oct 10, 2014 at 12:54:22PM -0500, Felipe Balbi wrote: is this power-off feature RTC-only mode ? Yes, I believe so, at least as long as RTC power is maintained. The pmic_power_en pin can otherwise still be used to power off. On the BeagleBone the PMIC can be configured to enter OFF or SLEEP mode on power off, where the latter (and default) mode keeps the RTC power supply enabled. Thanks for the fast review, Felipe. Great :) I assume adding the regulator support to this driver should also help in the 35xx case? If I remember correctly both OMAP and Sitara 35xx have no on-chip RTC so they won't be using this driver. Sorry I made a typo.. I meanto to ask if adding the regulator helps in your 335x case (not 35xx case)? Ah, sorry, that's what I first read before I noticed you wrote 35xx twice. :) Yes, RTC power can be configured as a regulator on am33xx (e.g. provided by LDO1 of the PMIC on BBB). I guess you would still need to configure it as always-on to be able to use the RTC-only mode, though. Johan -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 00/12] rtc: omap: fixes and power-off feature
* Johan Hovold jo...@kernel.org [141022 09:25]: On Wed, Oct 22, 2014 at 08:29:56AM -0700, Tony Lindgren wrote: * Johan Hovold jo...@kernel.org [141022 04:12]: On Sat, Oct 11, 2014 at 12:08:18PM -0700, Tony Lindgren wrote: * Johan Hovold jo...@kernel.org [141011 02:42]: On Fri, Oct 10, 2014 at 12:54:22PM -0500, Felipe Balbi wrote: is this power-off feature RTC-only mode ? Yes, I believe so, at least as long as RTC power is maintained. The pmic_power_en pin can otherwise still be used to power off. On the BeagleBone the PMIC can be configured to enter OFF or SLEEP mode on power off, where the latter (and default) mode keeps the RTC power supply enabled. Thanks for the fast review, Felipe. Great :) I assume adding the regulator support to this driver should also help in the 35xx case? If I remember correctly both OMAP and Sitara 35xx have no on-chip RTC so they won't be using this driver. Sorry I made a typo.. I meanto to ask if adding the regulator helps in your 335x case (not 35xx case)? Ah, sorry, that's what I first read before I noticed you wrote 35xx twice. :) Yes sorry my nerves are doing things on their own for some stuff it seems like :) Yes, RTC power can be configured as a regulator on am33xx (e.g. provided by LDO1 of the PMIC on BBB). I guess you would still need to configure it as always-on to be able to use the RTC-only mode, though. OK great. Tony -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 12/17] iommu/omap: Integrate omap-iommu-debug into omap-iommu
Hi Joerg, On 10/22/2014 08:29 AM, Joerg Roedel wrote: On Tue, Oct 21, 2014 at 04:28:27PM -0500, Suman Anna wrote: I am looking to refresh this series for 3.19, and this is the only patch that may need some changes. Please let me know what your preference is, and I can rework this patch if needed. Either way, the plan is to not have an OMAP IOMMU debugfs module, but only to have an option not to build the debugfs portions. Can I apply this series without this patch and you send me an updated version of only this patch? If yes, please let me know, otherwise please rebase the series on v3.18-rc1 and resend. Some of the patches following this patch don't apply without this patch, so this patch alone cannot be dropped. The preceding patches (Patches 1 through 11) are not affected though. I will rebase and resend the entire series. regards Suman -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 14/17] iommu/omap: Do not export unneeded functions
The following functions were exported previously for usage by the OMAP IOMMU debug module: omap_iommu_dump_ctx() omap_dump_tlb_entries() omap_iopgtable_store_entry() These functions need not be exported anymore as the OMAP IOMMU debugfs code is integrated with the OMAP IOMMU driver, and there won't be external users for these functions. So, remove the EXPORT_SYMBOL_GPL on these. The omap_iopgtable_store_entry() is also made internal only, after making the 'pagetable' debugfs entry read-only. Signed-off-by: Suman Anna s-a...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/iommu/omap-iommu.c | 6 ++ drivers/iommu/omap-iommu.h | 3 --- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index 9171112..3dcaef0 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -511,7 +511,6 @@ ssize_t omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t bytes) return bytes; } -EXPORT_SYMBOL_GPL(omap_iommu_dump_ctx); static int __dump_tlb_entries(struct omap_iommu *obj, struct cr_regs *crs, int num) @@ -579,7 +578,6 @@ size_t omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t bytes) return p - buf; } -EXPORT_SYMBOL_GPL(omap_dump_tlb_entries); #endif /* CONFIG_OMAP_IOMMU_DEBUG */ @@ -764,7 +762,8 @@ iopgtable_store_entry_core(struct omap_iommu *obj, struct iotlb_entry *e) * @obj: target iommu * @e: an iommu tlb entry info **/ -int omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e) +static int +omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e) { int err; @@ -774,7 +773,6 @@ int omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e) prefetch_iotlb_entry(obj, e); return err; } -EXPORT_SYMBOL_GPL(omap_iopgtable_store_entry); /** * iopgtable_lookup_entry - Lookup an iommu pte entry diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h index b18cecc..d736630 100644 --- a/drivers/iommu/omap-iommu.h +++ b/drivers/iommu/omap-iommu.h @@ -190,9 +190,6 @@ static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev) /* * global functions */ -extern int -omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e); - #ifdef CONFIG_OMAP_IOMMU_DEBUG extern ssize_t omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len); -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 16/17] iommu/omap: Fix bus error on debugfs access of unattached IOMMU
Any debugfs access on an OMAP IOMMU that is not enabled (done during attach) results in a bus error due to access of registers without the clock or the reset enabled for the respective IOMMU. So, add a check to make sure the IOMMU is enabled/attached by a client device. This gracefully prints a Operation not permitted trace when the corresponding IOMMU is not enabled. Signed-off-by: Suman Anna s-a...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/iommu/omap-iommu-debug.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index 4813d3a..41b09a1 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c @@ -24,6 +24,11 @@ static DEFINE_MUTEX(iommu_debug_lock); static struct dentry *iommu_debug_root; +static inline bool is_omap_iommu_detached(struct omap_iommu *obj) +{ + return !obj-domain; +} + static ssize_t debug_read_regs(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { @@ -31,6 +36,9 @@ static ssize_t debug_read_regs(struct file *file, char __user *userbuf, char *p, *buf; ssize_t bytes; + if (is_omap_iommu_detached(obj)) + return -EPERM; + buf = kmalloc(count, GFP_KERNEL); if (!buf) return -ENOMEM; @@ -54,6 +62,9 @@ static ssize_t debug_read_tlb(struct file *file, char __user *userbuf, char *p, *buf; ssize_t bytes, rest; + if (is_omap_iommu_detached(obj)) + return -EPERM; + buf = kmalloc(count, GFP_KERNEL); if (!buf) return -ENOMEM; @@ -139,6 +150,9 @@ static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf, char *p, *buf; size_t bytes; + if (is_omap_iommu_detached(obj)) + return -EPERM; + buf = (char *)__get_free_page(GFP_KERNEL); if (!buf) return -ENOMEM; -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 08/17] iommu/omap: Simplify omap2_iommu_fault_isr()
The function omap2_iommu_fault_isr() does an unnecessary recomputation of the return value. The logic relies on setting the same bit fields as the MMU fault error status bits, so simplify this function and remove the unneeded macros. These macros were originally exported to notify MMU faults to users prior to the IOMMU framework adaptation, but are now redundant. Signed-off-by: Suman Anna s-a...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/iommu/omap-iommu2.c | 20 +--- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/drivers/iommu/omap-iommu2.c b/drivers/iommu/omap-iommu2.c index 372141b..ce2fff3 100644 --- a/drivers/iommu/omap-iommu2.c +++ b/drivers/iommu/omap-iommu2.c @@ -53,13 +53,6 @@ ((pgsz) == MMU_CAM_PGSZ_64K) ? 0x :\ ((pgsz) == MMU_CAM_PGSZ_4K) ? 0xf000 : 0) -/* IOMMU errors */ -#define OMAP_IOMMU_ERR_TLB_MISS(1 0) -#define OMAP_IOMMU_ERR_TRANS_FAULT (1 1) -#define OMAP_IOMMU_ERR_EMU_MISS(1 2) -#define OMAP_IOMMU_ERR_TBLWALK_FAULT (1 3) -#define OMAP_IOMMU_ERR_MULTIHIT_FAULT (1 4) - static void __iommu_set_twl(struct omap_iommu *obj, bool on) { u32 l = iommu_read_reg(obj, MMU_CNTL); @@ -122,7 +115,6 @@ static void omap2_iommu_set_twl(struct omap_iommu *obj, bool on) static u32 omap2_iommu_fault_isr(struct omap_iommu *obj, u32 *ra) { u32 stat, da; - u32 errs = 0; stat = iommu_read_reg(obj, MMU_IRQSTATUS); stat = MMU_IRQ_MASK; @@ -134,19 +126,9 @@ static u32 omap2_iommu_fault_isr(struct omap_iommu *obj, u32 *ra) da = iommu_read_reg(obj, MMU_FAULT_AD); *ra = da; - if (stat MMU_IRQ_TLBMISS) - errs |= OMAP_IOMMU_ERR_TLB_MISS; - if (stat MMU_IRQ_TRANSLATIONFAULT) - errs |= OMAP_IOMMU_ERR_TRANS_FAULT; - if (stat MMU_IRQ_EMUMISS) - errs |= OMAP_IOMMU_ERR_EMU_MISS; - if (stat MMU_IRQ_TABLEWALKFAULT) - errs |= OMAP_IOMMU_ERR_TBLWALK_FAULT; - if (stat MMU_IRQ_MULTIHITFAULT) - errs |= OMAP_IOMMU_ERR_MULTIHIT_FAULT; iommu_write_reg(obj, stat, MMU_IRQSTATUS); - return errs; + return stat; } static void omap2_tlb_read_cr(struct omap_iommu *obj, struct cr_regs *cr) -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 11/17] iommu/omap: Make pagetable debugfs entry read-only
Remove the writeability on the 'pagetable' debugfs entry, so that the mapping/unmapping into an OMAP IOMMU is only limited to actual client devices/drivers at kernel-level. Signed-off-by: Suman Anna s-a...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/iommu/omap-iommu-debug.c | 48 ++-- 1 file changed, 2 insertions(+), 46 deletions(-) diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index a520438..28de657 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c @@ -24,8 +24,6 @@ #include omap-iopgtable.h #include omap-iommu.h -#define MAXCOLUMN 100 /* for short messages */ - static DEFINE_MUTEX(iommu_debug_lock); static struct dentry *iommu_debug_root; @@ -82,39 +80,6 @@ static ssize_t debug_read_tlb(struct file *file, char __user *userbuf, return bytes; } -static ssize_t debug_write_pagetable(struct file *file, -const char __user *userbuf, size_t count, loff_t *ppos) -{ - struct iotlb_entry e; - struct cr_regs cr; - int err; - struct device *dev = file-private_data; - struct omap_iommu *obj = dev_to_omap_iommu(dev); - char buf[MAXCOLUMN], *p = buf; - - count = min(count, sizeof(buf)); - - mutex_lock(iommu_debug_lock); - if (copy_from_user(p, userbuf, count)) { - mutex_unlock(iommu_debug_lock); - return -EFAULT; - } - - sscanf(p, %x %x, cr.cam, cr.ram); - if (!cr.cam || !cr.ram) { - mutex_unlock(iommu_debug_lock); - return -EINVAL; - } - - omap_iotlb_cr_to_e(cr, e); - err = omap_iopgtable_store_entry(obj, e); - if (err) - dev_err(obj-dev, %s: fail to store cr\n, __func__); - - mutex_unlock(iommu_debug_lock); - return count; -} - #define dump_ioptable_entry_one(lv, da, val) \ ({ \ int __err = 0; \ @@ -202,14 +167,6 @@ static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf, return bytes; } -#define DEBUG_FOPS(name) \ - static const struct file_operations debug_##name##_fops = { \ - .open = simple_open,\ - .read = debug_read_##name, \ - .write = debug_write_##name,\ - .llseek = generic_file_llseek, \ - }; - #define DEBUG_FOPS_RO(name)\ static const struct file_operations debug_##name##_fops = { \ .open = simple_open,\ @@ -219,7 +176,7 @@ static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf, DEBUG_FOPS_RO(regs); DEBUG_FOPS_RO(tlb); -DEBUG_FOPS(pagetable); +DEBUG_FOPS_RO(pagetable); #define __DEBUG_ADD_FILE(attr, mode) \ { \ @@ -230,7 +187,6 @@ DEBUG_FOPS(pagetable); return -ENOMEM; \ } -#define DEBUG_ADD_FILE(name) __DEBUG_ADD_FILE(name, 0600) #define DEBUG_ADD_FILE_RO(name) __DEBUG_ADD_FILE(name, 0400) static int iommu_debug_register(struct device *dev, void *data) @@ -263,7 +219,7 @@ static int iommu_debug_register(struct device *dev, void *data) DEBUG_ADD_FILE_RO(regs); DEBUG_ADD_FILE_RO(tlb); - DEBUG_ADD_FILE(pagetable); + DEBUG_ADD_FILE_RO(pagetable); return 0; -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 10/17] iommu/omap: Fix the permissions on nr_tlb_entries
The permissions on the debugfs entry nr_tlb_entries should have been octal, not decimal, so fix it. Signed-off-by: Suman Anna s-a...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/iommu/omap-iommu-debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index 0fb92aa..a520438 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c @@ -256,7 +256,7 @@ static int iommu_debug_register(struct device *dev, void *data) goto nomem; parent = d; - d = debugfs_create_u8(nr_tlb_entries, 400, parent, + d = debugfs_create_u8(nr_tlb_entries, 0400, parent, (u8 *)obj-nr_tlb_entries); if (!d) goto nomem; -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 02/17] iommu/omap: Remove unused isr_priv field from omap_iommu
The isr_priv field is a left-over from before the IOMMU API adaptation, this was used to store the callback data. This is no longer relevant, so remove it. Signed-off-by: Suman Anna s-a...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/iommu/omap-iommu.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h index 5c14000..18a0f3a 100644 --- a/drivers/iommu/omap-iommu.h +++ b/drivers/iommu/omap-iommu.h @@ -30,7 +30,6 @@ struct omap_iommu { const char *name; void __iomem*regbase; struct device *dev; - void*isr_priv; struct iommu_domain *domain; spinlock_t iommu_lock; /* global for this whole object */ -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 07/17] iommu/omap: Remove bogus version check in context save/restore
The omap2_iommu_save_ctx() and omap2_iommu_restore_ctx() performs a sanity version check against a fixed value that is correct only for OMAP2/OMAP3 IOMMUs. This fixed check does not scale for all OMAP2+ IOMMUs and is not absolutely required, so it has been removed. Signed-off-by: Suman Anna s-a...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/iommu/omap-iommu2.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/iommu/omap-iommu2.c b/drivers/iommu/omap-iommu2.c index 2f6a9f7..372141b 100644 --- a/drivers/iommu/omap-iommu2.c +++ b/drivers/iommu/omap-iommu2.c @@ -26,8 +26,6 @@ /* * omap2 architecture specific register bit definitions */ -#define IOMMU_ARCH_VERSION 0x0011 - /* IRQSTATUS IRQENABLE */ #define MMU_IRQ_MULTIHITFAULT (1 4) #define MMU_IRQ_TABLEWALKFAULT (1 3) @@ -268,8 +266,6 @@ static void omap2_iommu_save_ctx(struct omap_iommu *obj) p[i] = iommu_read_reg(obj, i * sizeof(u32)); dev_dbg(obj-dev, %s\t[%02d] %08x\n, __func__, i, p[i]); } - - BUG_ON(p[0] != IOMMU_ARCH_VERSION); } static void omap2_iommu_restore_ctx(struct omap_iommu *obj) @@ -281,8 +277,6 @@ static void omap2_iommu_restore_ctx(struct omap_iommu *obj) iommu_write_reg(obj, p[i], i * sizeof(u32)); dev_dbg(obj-dev, %s\t[%02d] %08x\n, __func__, i, p[i]); } - - BUG_ON(p[0] != IOMMU_ARCH_VERSION); } static void omap2_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e) -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 00/17] OMAP IOMMU Cleanup Consolidation
Hi, This is an updated version of the OMAP IOMMU Cleanup Consolidation patch series [1], rebased onto 3.18-rc1. The update addresses comments on patch 12 [2] from the previous series, there are no changes to any of the other patches. The series is intended for the 3.19 merge window. A reference branch with all these patches is available is hosted at [3]. Following is the summary of changes in v2: - Series rebased to 3.18-rc1. - Added back the OMAP_IOMMU_DEBUG Kconfig option that was removed in v1 in Patch 12. This allows the debugfs portions to be built conditionally. - Added the Acked-by received from Laurent on all patches except Patch 12. - Patches 13 through 17 have no code changes but have to rebased because of the updates to Patch 12. v1: - See [1] for details regards Suman [1] http://marc.info/?l=linux-omapm=141211179711402w=2 [2] https://patchwork.kernel.org/patch/5007261/ [3] https://github.com/sumananna/omap-kernel/commits/iommu/submit/3.18-rc1-cleanup-consolidation-v2 Suman Anna (17): iommu/omap: Remove refcount field from omap_iommu object iommu/omap: Remove unused isr_priv field from omap_iommu iommu/omap: Remove duplicate declarations iommu/omap: Remove conditional definition of dev_to_omap_iommu() iommu/omap: Remove ver debugfs entry iommu/omap: Remove omap_iommu_arch_version() and version field iommu/omap: Remove bogus version check in context save/restore iommu/omap: Simplify omap2_iommu_fault_isr() iommu/omap: Consolidate OMAP IOMMU modules iommu/omap: Fix the permissions on nr_tlb_entries iommu/omap: Make pagetable debugfs entry read-only iommu/omap: Integrate omap-iommu-debug into omap-iommu iommu/omap: Remove couple of unused exported functions iommu/omap: Do not export unneeded functions iommu/omap: Reset the domain field upon detaching iommu/omap: Fix bus error on debugfs access of unattached IOMMU iommu/omap: Switch pagetable debugfs entry to use seq_file drivers/iommu/Kconfig| 12 +- drivers/iommu/Makefile | 1 - drivers/iommu/omap-iommu-debug.c | 242 drivers/iommu/omap-iommu.c | 306 ++- drivers/iommu/omap-iommu.h | 98 ++-- drivers/iommu/omap-iommu2.c | 337 --- 6 files changed, 312 insertions(+), 684 deletions(-) delete mode 100644 drivers/iommu/omap-iommu2.c -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 03/17] iommu/omap: Remove duplicate declarations
The omap_iommu_save_ctx() and omap_iommu_restore_ctx() declarations are defined in include/linux/omap-iommu.h and do not belong in the internal drivers/iommu/omap-iommu.h header, so remove them. Signed-off-by: Suman Anna s-a...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/iommu/omap-iommu.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h index 18a0f3a..4fc51c8 100644 --- a/drivers/iommu/omap-iommu.h +++ b/drivers/iommu/omap-iommu.h @@ -197,9 +197,6 @@ extern void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e); extern int omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e); -extern void omap_iommu_save_ctx(struct device *dev); -extern void omap_iommu_restore_ctx(struct device *dev); - extern int omap_foreach_iommu_device(void *data, int (*fn)(struct device *, void *)); -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 15/17] iommu/omap: Reset the domain field upon detaching
The .domain field in omap_iommu struct is set properly when the OMAP IOMMU device is attached to, but is never reset properly on detach. Reset this properly so that the OMAP IOMMU debugfs logic can depend on this field before allowing the debugfs operations. Signed-off-by: Suman Anna s-a...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/iommu/omap-iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index 3dcaef0..2ba3219 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -1206,6 +1206,7 @@ static void _omap_iommu_detach_dev(struct omap_iommu_domain *omap_domain, omap_domain-iommu_dev = arch_data-iommu_dev = NULL; omap_domain-dev = NULL; + oiommu-domain = NULL; } static void omap_iommu_detach_dev(struct iommu_domain *domain, -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 06/17] iommu/omap: Remove omap_iommu_arch_version() and version field
The function omap_iommu_arch_version() is not used anymore, and is not required either, so remove it. The .version field in struct iommu_functions that this function uses is also removed, as it is not really an ops to retrieve a version and there won't be any usage for this field either. Signed-off-by: Suman Anna s-a...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/iommu/omap-iommu.c | 9 - drivers/iommu/omap-iommu.h | 4 drivers/iommu/omap-iommu2.c | 2 -- 3 files changed, 15 deletions(-) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index ea04e4d..f9efa6b 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -138,15 +138,6 @@ void omap_iommu_restore_ctx(struct device *dev) } EXPORT_SYMBOL_GPL(omap_iommu_restore_ctx); -/** - * omap_iommu_arch_version - Return running iommu arch version - **/ -u32 omap_iommu_arch_version(void) -{ - return arch_iommu-version; -} -EXPORT_SYMBOL_GPL(omap_iommu_arch_version); - static int iommu_enable(struct omap_iommu *obj) { int err; diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h index d7c5132..45fe67d 100644 --- a/drivers/iommu/omap-iommu.h +++ b/drivers/iommu/omap-iommu.h @@ -70,8 +70,6 @@ struct cr_regs { /* architecture specific functions */ struct iommu_functions { - unsigned long version; - int (*enable)(struct omap_iommu *obj); void (*disable)(struct omap_iommu *obj); void (*set_twl)(struct omap_iommu *obj, bool on); @@ -191,8 +189,6 @@ static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev) /* * global functions */ -extern u32 omap_iommu_arch_version(void); - extern void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e); extern int diff --git a/drivers/iommu/omap-iommu2.c b/drivers/iommu/omap-iommu2.c index 5e1ea3b..2f6a9f7 100644 --- a/drivers/iommu/omap-iommu2.c +++ b/drivers/iommu/omap-iommu2.c @@ -297,8 +297,6 @@ static void omap2_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e) } static const struct iommu_functions omap2_iommu_ops = { - .version= IOMMU_ARCH_VERSION, - .enable = omap2_iommu_enable, .disable= omap2_iommu_disable, .set_twl= omap2_iommu_set_twl, -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 12/17] iommu/omap: Integrate omap-iommu-debug into omap-iommu
The debugfs support for OMAP IOMMU is currently implemented as a module, warranting certain OMAP-specific IOMMU API to be exported. The OMAP IOMMU, when enabled, can only be built-in into the kernel, so integrate the OMAP IOMMU debug module into the OMAP IOMMU driver. This helps in eliminating the need to export most of the current OMAP IOMMU API. The following are the main changes: - The debugfs directory and entry creation logic is reversed, the calls are invoked by the OMAP IOMMU driver now. - The current iffy circular logic of adding IOMMU archdata to the IOMMU devices itself to get a pointer to the omap_iommu object in the debugfs support code is replaced by directly using the omap_iommu structure while creating the debugfs entries. - The debugfs root directory is renamed from the generic name iommu to a specific name omap_iommu. - Unneeded headers have also been cleaned up while at this. - There will no longer be a omap-iommu-debug.ko module after this patch. - The OMAP_IOMMU_DEBUG Kconfig option is converted to boolean only, the OMAP IOMMU debugfs support is built alongside the OMAP IOMMU driver only when this option is enabled. Signed-off-by: Suman Anna s-a...@ti.com --- drivers/iommu/Kconfig| 12 ++--- drivers/iommu/omap-iommu-debug.c | 100 +++ drivers/iommu/omap-iommu.c | 11 - drivers/iommu/omap-iommu.h | 15 ++ 4 files changed, 58 insertions(+), 80 deletions(-) diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index dd51122..1d54996 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -144,13 +144,13 @@ config OMAP_IOMMU select IOMMU_API config OMAP_IOMMU_DEBUG - tristate Export OMAP IOMMU internals in DebugFS - depends on OMAP_IOMMU DEBUG_FS - help - Select this to see extensive information about - the internal state of OMAP IOMMU in debugfs. + bool Export OMAP IOMMU internals in DebugFS + depends on OMAP_IOMMU DEBUG_FS + ---help--- + Select this to see extensive information about + the internal state of OMAP IOMMU in debugfs. - Say N unless you know you need this. + Say N unless you know you need this. config TEGRA_IOMMU_GART bool Tegra GART IOMMU Support diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index 28de657..4813d3a 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c @@ -10,15 +10,11 @@ * published by the Free Software Foundation. */ -#include linux/module.h #include linux/err.h -#include linux/clk.h #include linux/io.h #include linux/slab.h #include linux/uaccess.h -#include linux/platform_device.h #include linux/debugfs.h -#include linux/omap-iommu.h #include linux/platform_data/iommu-omap.h #include omap-iopgtable.h @@ -31,8 +27,7 @@ static struct dentry *iommu_debug_root; static ssize_t debug_read_regs(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - struct device *dev = file-private_data; - struct omap_iommu *obj = dev_to_omap_iommu(dev); + struct omap_iommu *obj = file-private_data; char *p, *buf; ssize_t bytes; @@ -55,8 +50,7 @@ static ssize_t debug_read_regs(struct file *file, char __user *userbuf, static ssize_t debug_read_tlb(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - struct device *dev = file-private_data; - struct omap_iommu *obj = dev_to_omap_iommu(dev); + struct omap_iommu *obj = file-private_data; char *p, *buf; ssize_t bytes, rest; @@ -141,8 +135,7 @@ out: static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - struct device *dev = file-private_data; - struct omap_iommu *obj = dev_to_omap_iommu(dev); + struct omap_iommu *obj = file-private_data; char *p, *buf; size_t bytes; @@ -181,93 +174,56 @@ DEBUG_FOPS_RO(pagetable); #define __DEBUG_ADD_FILE(attr, mode) \ { \ struct dentry *dent;\ - dent = debugfs_create_file(#attr, mode, parent, \ - dev, debug_##attr##_fops); \ + dent = debugfs_create_file(#attr, mode, obj-debug_dir, \ + obj, debug_##attr##_fops); \ if (!dent) \ - return -ENOMEM; \ + goto err; \ } #define DEBUG_ADD_FILE_RO(name) __DEBUG_ADD_FILE(name, 0400) -static int
[PATCH v2 09/17] iommu/omap: Consolidate OMAP IOMMU modules
The OMAP IOMMU driver was originally designed as modules, and split into a core module and a thin arch-specific module through the OMAP arch-specific struct iommu_functions, to scale for both OMAP1 and OMAP2+ IOMMU variants. The driver can only be built for OMAP2+ platforms currently, and also can only be built-in after the adaptation to generic IOMMU API. The OMAP1 variant was never added and will most probably be never added (the code for the only potential user, its parent, DSP processor has already been cleaned up). So, consolidate the OMAP2 specific omap-iommu2 module into the core OMAP IOMMU driver - this eliminates the arch-specific ops structure and simplifies the driver into a single module that only implements the generic IOMMU API's iommu_ops. The following are the main changes: - omap-iommu2 module is completely eliminated, with the common definitions moved to the internal omap-iommu.h, and the ops implementations moved into omap-iommu.c - OMAP arch-specific struct iommu_functions is also eliminated, with the ops implementations directly absorbed into the calling functions - iotlb_alloc_cr() is no longer inlined and defined only when PREFETCH_IOTLB is defined - iotlb_dump_cr() is similarly defined only when CONFIG_OMAP_IOMMU_DEBUG is defined - Elimination of the OMAP IOMMU exported functions to register the arch ops, omap_install_iommu_arch() omap_uninstall_iommu_arch() - Any stale comments about OMAP1 are also cleaned up Signed-off-by: Suman Anna s-a...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/iommu/Makefile | 1 - drivers/iommu/omap-iommu.c | 263 ++--- drivers/iommu/omap-iommu.h | 61 + drivers/iommu/omap-iommu2.c | 311 4 files changed, 217 insertions(+), 419 deletions(-) delete mode 100644 drivers/iommu/omap-iommu2.c diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile index 16edef7..18fa446 100644 --- a/drivers/iommu/Makefile +++ b/drivers/iommu/Makefile @@ -11,7 +11,6 @@ obj-$(CONFIG_INTEL_IOMMU) += iova.o intel-iommu.o obj-$(CONFIG_IPMMU_VMSA) += ipmmu-vmsa.o obj-$(CONFIG_IRQ_REMAP) += intel_irq_remapping.o irq_remapping.o obj-$(CONFIG_OMAP_IOMMU) += omap-iommu.o -obj-$(CONFIG_OMAP_IOMMU) += omap-iommu2.o obj-$(CONFIG_OMAP_IOMMU_DEBUG) += omap-iommu-debug.o obj-$(CONFIG_TEGRA_IOMMU_GART) += tegra-gart.o obj-$(CONFIG_TEGRA_IOMMU_SMMU) += tegra-smmu.o diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index f9efa6b..91262fa 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -76,53 +76,23 @@ struct iotlb_lock { short vict; }; -/* accommodate the difference between omap1 and omap2/3 */ -static const struct iommu_functions *arch_iommu; - static struct platform_driver omap_iommu_driver; static struct kmem_cache *iopte_cachep; /** - * omap_install_iommu_arch - Install archtecure specific iommu functions - * @ops: a pointer to architecture specific iommu functions - * - * There are several kind of iommu algorithm(tlb, pagetable) among - * omap series. This interface installs such an iommu algorighm. - **/ -int omap_install_iommu_arch(const struct iommu_functions *ops) -{ - if (arch_iommu) - return -EBUSY; - - arch_iommu = ops; - return 0; -} -EXPORT_SYMBOL_GPL(omap_install_iommu_arch); - -/** - * omap_uninstall_iommu_arch - Uninstall archtecure specific iommu functions - * @ops: a pointer to architecture specific iommu functions - * - * This interface uninstalls the iommu algorighm installed previously. - **/ -void omap_uninstall_iommu_arch(const struct iommu_functions *ops) -{ - if (arch_iommu != ops) - pr_err(%s: not your arch\n, __func__); - - arch_iommu = NULL; -} -EXPORT_SYMBOL_GPL(omap_uninstall_iommu_arch); - -/** * omap_iommu_save_ctx - Save registers for pm off-mode support * @dev: client device **/ void omap_iommu_save_ctx(struct device *dev) { struct omap_iommu *obj = dev_to_omap_iommu(dev); + u32 *p = obj-ctx; + int i; - arch_iommu-save_ctx(obj); + for (i = 0; i (MMU_REG_SIZE / sizeof(u32)); i++) { + p[i] = iommu_read_reg(obj, i * sizeof(u32)); + dev_dbg(obj-dev, %s\t[%02d] %08x\n, __func__, i, p[i]); + } } EXPORT_SYMBOL_GPL(omap_iommu_save_ctx); @@ -133,20 +103,75 @@ EXPORT_SYMBOL_GPL(omap_iommu_save_ctx); void omap_iommu_restore_ctx(struct device *dev) { struct omap_iommu *obj = dev_to_omap_iommu(dev); + u32 *p = obj-ctx; + int i; - arch_iommu-restore_ctx(obj); + for (i = 0; i (MMU_REG_SIZE / sizeof(u32)); i++) { + iommu_write_reg(obj, p[i], i * sizeof(u32)); + dev_dbg(obj-dev, %s\t[%02d] %08x\n, __func__, i, p[i]); + } } EXPORT_SYMBOL_GPL(omap_iommu_restore_ctx); +static void __iommu_set_twl(struct omap_iommu *obj, bool on) +{ +
[PATCH v2 13/17] iommu/omap: Remove couple of unused exported functions
The exported functions omap_foreach_iommu_device() and omap_iotlb_cr_to_e() have been deleted, as they are no longer needed. The function omap_foreach_iommu_device() is not required after the consolidation of the OMAP IOMMU debug module, and the function omap_iotlb_cr_to_e() is not required after making the debugfs entry 'pagetable' read-only. Signed-off-by: Suman Anna s-a...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/iommu/omap-iommu.c | 21 - drivers/iommu/omap-iommu.h | 5 - 2 files changed, 26 deletions(-) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index b92b6fc..9171112 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -203,20 +203,6 @@ static void iommu_disable(struct omap_iommu *obj) /* * TLB operations */ -void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e) -{ - BUG_ON(!cr || !e); - - e-da = cr-cam MMU_CAM_VATAG_MASK; - e-pa = cr-ram MMU_RAM_PADDR_MASK; - e-valid= cr-cam MMU_CAM_V; - e-pgsz = cr-cam MMU_CAM_PGSZ_MASK; - e-endian = cr-ram MMU_RAM_ENDIAN_MASK; - e-elsz = cr-ram MMU_RAM_ELSZ_MASK; - e-mixed= cr-ram MMU_RAM_MIXED; -} -EXPORT_SYMBOL_GPL(omap_iotlb_cr_to_e); - static inline int iotlb_cr_valid(struct cr_regs *cr) { if (!cr) @@ -595,13 +581,6 @@ size_t omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t bytes) } EXPORT_SYMBOL_GPL(omap_dump_tlb_entries); -int omap_foreach_iommu_device(void *data, int (*fn)(struct device *, void *)) -{ - return driver_for_each_device(omap_iommu_driver.driver, - NULL, data, fn); -} -EXPORT_SYMBOL_GPL(omap_foreach_iommu_device); - #endif /* CONFIG_OMAP_IOMMU_DEBUG */ /* diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h index 4783779..b18cecc 100644 --- a/drivers/iommu/omap-iommu.h +++ b/drivers/iommu/omap-iommu.h @@ -190,14 +190,9 @@ static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev) /* * global functions */ -extern void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e); - extern int omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e); -extern int omap_foreach_iommu_device(void *data, - int (*fn)(struct device *, void *)); - #ifdef CONFIG_OMAP_IOMMU_DEBUG extern ssize_t omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len); -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 05/17] iommu/omap: Remove ver debugfs entry
The debugfs entry 'ver' to read the OMAP IOMMU version is not much useful for developers, so it has been removed. The same can be deduced from the register dump, provided by the debugfs entry 'regs', REVISION register. This also allows us to remove the omap_iommu_arch_revision() which is currently returning a fixed value. Signed-off-by: Suman Anna s-a...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/iommu/omap-iommu-debug.c | 13 - 1 file changed, 13 deletions(-) diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index 531658d..0fb92aa 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c @@ -30,17 +30,6 @@ static DEFINE_MUTEX(iommu_debug_lock); static struct dentry *iommu_debug_root; -static ssize_t debug_read_ver(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - u32 ver = omap_iommu_arch_version(); - char buf[MAXCOLUMN], *p = buf; - - p += sprintf(p, H/W version: %d.%d\n, (ver 4) 0xf , ver 0xf); - - return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); -} - static ssize_t debug_read_regs(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { @@ -228,7 +217,6 @@ static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf, .llseek = generic_file_llseek, \ }; -DEBUG_FOPS_RO(ver); DEBUG_FOPS_RO(regs); DEBUG_FOPS_RO(tlb); DEBUG_FOPS(pagetable); @@ -273,7 +261,6 @@ static int iommu_debug_register(struct device *dev, void *data) if (!d) goto nomem; - DEBUG_ADD_FILE_RO(ver); DEBUG_ADD_FILE_RO(regs); DEBUG_ADD_FILE_RO(tlb); DEBUG_ADD_FILE(pagetable); -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 17/17] iommu/omap: Switch pagetable debugfs entry to use seq_file
The debugfs entry 'pagetable' that shows the page table entry (PTE) data currently outputs only data that can be fit into a page. Switch the entry to use the seq_file interface so that it can show all the valid page table entries. The patch also corrected the output for L2 entries, and prints the proper L2 PTE instead of the previous L1 page descriptor pointer. Signed-off-by: Suman Anna s-a...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/iommu/omap-iommu-debug.c | 81 ++-- 1 file changed, 28 insertions(+), 53 deletions(-) diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index 41b09a1..f3d20a2 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c @@ -85,95 +85,70 @@ static ssize_t debug_read_tlb(struct file *file, char __user *userbuf, return bytes; } -#define dump_ioptable_entry_one(lv, da, val) \ - ({ \ - int __err = 0; \ - ssize_t bytes; \ - const int maxcol = 22; \ - const char *str = %d: %08x %08x\n;\ - bytes = snprintf(p, maxcol, str, lv, da, val); \ - p += bytes; \ - len -= bytes; \ - if (len maxcol) \ - __err = -ENOMEM;\ - __err; \ - }) - -static ssize_t dump_ioptable(struct omap_iommu *obj, char *buf, ssize_t len) +static void dump_ioptable(struct seq_file *s) { - int i; - u32 *iopgd; - char *p = buf; + int i, j; + u32 da; + u32 *iopgd, *iopte; + struct omap_iommu *obj = s-private; spin_lock(obj-page_table_lock); iopgd = iopgd_offset(obj, 0); for (i = 0; i PTRS_PER_IOPGD; i++, iopgd++) { - int j, err; - u32 *iopte; - u32 da; - if (!*iopgd) continue; if (!(*iopgd IOPGD_TABLE)) { da = i IOPGD_SHIFT; - - err = dump_ioptable_entry_one(1, da, *iopgd); - if (err) - goto out; + seq_printf(s, 1: 0x%08x 0x%08x\n, da, *iopgd); continue; } iopte = iopte_offset(iopgd, 0); - for (j = 0; j PTRS_PER_IOPTE; j++, iopte++) { if (!*iopte) continue; da = (i IOPGD_SHIFT) + (j IOPTE_SHIFT); - err = dump_ioptable_entry_one(2, da, *iopgd); - if (err) - goto out; + seq_printf(s, 2: 0x%08x 0x%08x\n, da, *iopte); } } -out: - spin_unlock(obj-page_table_lock); - return p - buf; + spin_unlock(obj-page_table_lock); } -static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) +static int debug_read_pagetable(struct seq_file *s, void *data) { - struct omap_iommu *obj = file-private_data; - char *p, *buf; - size_t bytes; + struct omap_iommu *obj = s-private; if (is_omap_iommu_detached(obj)) return -EPERM; - buf = (char *)__get_free_page(GFP_KERNEL); - if (!buf) - return -ENOMEM; - p = buf; - - p += sprintf(p, L: %8s %8s\n, da:, pa:); - p += sprintf(p, -\n); - mutex_lock(iommu_debug_lock); - bytes = PAGE_SIZE - (p - buf); - p += dump_ioptable(obj, p, bytes); - - bytes = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); + seq_printf(s, L: %8s %8s\n, da:, pte:); + seq_puts(s, --\n); + dump_ioptable(s); mutex_unlock(iommu_debug_lock); - free_page((unsigned long)buf); - return bytes; + return 0; } +#define DEBUG_SEQ_FOPS_RO(name) \ + static int debug_open_##name(struct inode *inode, struct file *file) \ + { \ + return single_open(file, debug_read_##name, inode-i_private); \ + } \ + \ + static const struct file_operations debug_##name##_fops = {\ + .open
[PATCH v2 04/17] iommu/omap: Remove conditional definition of dev_to_omap_iommu()
The dev_to_omap_iommu() is local to the OMAP IOMMU modules, and need not be defined conditionally. The CONFIG_IOMMU_API dependency check was added in the past to fix a compilation issue back when the header resided in the arch/arm layers, and is no longer needed. While at this, fix the header against double inclusion as well. Signed-off-by: Suman Anna s-a...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/iommu/omap-iommu.h | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h index 4fc51c8..d7c5132 100644 --- a/drivers/iommu/omap-iommu.h +++ b/drivers/iommu/omap-iommu.h @@ -10,6 +10,9 @@ * published by the Free Software Foundation. */ +#ifndef _OMAP_IOMMU_H +#define _OMAP_IOMMU_H + #if defined(CONFIG_ARCH_OMAP1) #error iommu for this processor not implemented yet #endif @@ -92,7 +95,6 @@ struct iommu_functions { ssize_t (*dump_ctx)(struct omap_iommu *obj, char *buf, ssize_t len); }; -#ifdef CONFIG_IOMMU_API /** * dev_to_omap_iommu() - retrieves an omap iommu object from a user device * @dev: iommu client device @@ -103,7 +105,6 @@ static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev) return arch_data-iommu_dev; } -#endif /* * MMU Register offsets @@ -220,3 +221,5 @@ static inline void iommu_write_reg(struct omap_iommu *obj, u32 val, size_t offs) { __raw_writel(val, obj-regbase + offs); } + +#endif /* _OMAP_IOMMU_H */ -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 01/17] iommu/omap: Remove refcount field from omap_iommu object
The refcount field in omap_iommu object is primarily used to check if an IOMMU device has already been enabled, but this is already implicit in the omap_iommu_attach_dev() which ensures that only a single device can attach to an IOMMU. This field is redundant, and so has been cleaned up. Signed-off-by: Suman Anna s-a...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/iommu/omap-iommu.c | 15 +++ drivers/iommu/omap-iommu.h | 1 - 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index 3627887..ea04e4d 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -819,8 +819,9 @@ static irqreturn_t iommu_fault_handler(int irq, void *data) u32 *iopgd, *iopte; struct omap_iommu *obj = data; struct iommu_domain *domain = obj-domain; + struct omap_iommu_domain *omap_domain = domain-priv; - if (!obj-refcount) + if (!omap_domain-iommu_dev) return IRQ_NONE; errs = iommu_report_fault(obj, da); @@ -880,13 +881,6 @@ static struct omap_iommu *omap_iommu_attach(const char *name, u32 *iopgd) spin_lock(obj-iommu_lock); - /* an iommu device can only be attached once */ - if (++obj-refcount 1) { - dev_err(dev, %s: already attached!\n, obj-name); - err = -EBUSY; - goto err_enable; - } - obj-iopgd = iopgd; err = iommu_enable(obj); if (err) @@ -899,7 +893,6 @@ static struct omap_iommu *omap_iommu_attach(const char *name, u32 *iopgd) return obj; err_enable: - obj-refcount--; spin_unlock(obj-iommu_lock); return ERR_PTR(err); } @@ -915,9 +908,7 @@ static void omap_iommu_detach(struct omap_iommu *obj) spin_lock(obj-iommu_lock); - if (--obj-refcount == 0) - iommu_disable(obj); - + iommu_disable(obj); obj-iopgd = NULL; spin_unlock(obj-iommu_lock); diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h index 4f1b68c..5c14000 100644 --- a/drivers/iommu/omap-iommu.h +++ b/drivers/iommu/omap-iommu.h @@ -33,7 +33,6 @@ struct omap_iommu { void*isr_priv; struct iommu_domain *domain; - unsigned intrefcount; spinlock_t iommu_lock; /* global for this whole object */ /* -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 12/17] iommu/omap: Integrate omap-iommu-debug into omap-iommu
Hi Suman, Thank you for the patch. On Wednesday 22 October 2014 17:22:30 Suman Anna wrote: The debugfs support for OMAP IOMMU is currently implemented as a module, warranting certain OMAP-specific IOMMU API to be exported. The OMAP IOMMU, when enabled, can only be built-in into the kernel, so integrate the OMAP IOMMU debug module into the OMAP IOMMU driver. This helps in eliminating the need to export most of the current OMAP IOMMU API. The following are the main changes: - The debugfs directory and entry creation logic is reversed, the calls are invoked by the OMAP IOMMU driver now. - The current iffy circular logic of adding IOMMU archdata to the IOMMU devices itself to get a pointer to the omap_iommu object in the debugfs support code is replaced by directly using the omap_iommu structure while creating the debugfs entries. - The debugfs root directory is renamed from the generic name iommu to a specific name omap_iommu. - Unneeded headers have also been cleaned up while at this. - There will no longer be a omap-iommu-debug.ko module after this patch. - The OMAP_IOMMU_DEBUG Kconfig option is converted to boolean only, the OMAP IOMMU debugfs support is built alongside the OMAP IOMMU driver only when this option is enabled. Signed-off-by: Suman Anna s-a...@ti.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/iommu/Kconfig| 12 ++--- drivers/iommu/omap-iommu-debug.c | 100 ++- drivers/iommu/omap-iommu.c | 11 - drivers/iommu/omap-iommu.h | 15 ++ 4 files changed, 58 insertions(+), 80 deletions(-) diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index dd51122..1d54996 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -144,13 +144,13 @@ config OMAP_IOMMU select IOMMU_API config OMAP_IOMMU_DEBUG - tristate Export OMAP IOMMU internals in DebugFS - depends on OMAP_IOMMU DEBUG_FS - help - Select this to see extensive information about - the internal state of OMAP IOMMU in debugfs. + bool Export OMAP IOMMU internals in DebugFS + depends on OMAP_IOMMU DEBUG_FS + ---help--- + Select this to see extensive information about + the internal state of OMAP IOMMU in debugfs. - Say N unless you know you need this. + Say N unless you know you need this. config TEGRA_IOMMU_GART bool Tegra GART IOMMU Support diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index 28de657..4813d3a 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c @@ -10,15 +10,11 @@ * published by the Free Software Foundation. */ -#include linux/module.h #include linux/err.h -#include linux/clk.h #include linux/io.h #include linux/slab.h #include linux/uaccess.h -#include linux/platform_device.h #include linux/debugfs.h -#include linux/omap-iommu.h #include linux/platform_data/iommu-omap.h #include omap-iopgtable.h @@ -31,8 +27,7 @@ static struct dentry *iommu_debug_root; static ssize_t debug_read_regs(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - struct device *dev = file-private_data; - struct omap_iommu *obj = dev_to_omap_iommu(dev); + struct omap_iommu *obj = file-private_data; char *p, *buf; ssize_t bytes; @@ -55,8 +50,7 @@ static ssize_t debug_read_regs(struct file *file, char __user *userbuf, static ssize_t debug_read_tlb(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - struct device *dev = file-private_data; - struct omap_iommu *obj = dev_to_omap_iommu(dev); + struct omap_iommu *obj = file-private_data; char *p, *buf; ssize_t bytes, rest; @@ -141,8 +135,7 @@ out: static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { - struct device *dev = file-private_data; - struct omap_iommu *obj = dev_to_omap_iommu(dev); + struct omap_iommu *obj = file-private_data; char *p, *buf; size_t bytes; @@ -181,93 +174,56 @@ DEBUG_FOPS_RO(pagetable); #define __DEBUG_ADD_FILE(attr, mode) \ { \ struct dentry *dent;\ - dent = debugfs_create_file(#attr, mode, parent, \ -dev, debug_##attr##_fops); \ + dent = debugfs_create_file(#attr, mode, obj-debug_dir, \ +obj, debug_##attr##_fops); \ if (!dent) \ - return -ENOMEM; \ + goto err;